xinclude all children

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • McSwell

    xinclude all children

    I have an XML file that looks something like this:
    ------------------------
    <?xml ...?>
    <!DOCTYPE ...>
    <src:fragment id="foo" ...>
    <Ph:Itemsome stuff </Ph:Item>
    <Ph:Itemsome more stuff </Ph:Item>
    ....
    <Ph:Itemstill more stuff </Ph:Item>
    </src:fragment>
    ----------------------

    I want to xinclude all the children of the root element into another
    XML file. I've been trying things like
    <xi:include href="firstFile Name" xpointer="foo/1"/>
    However, if(!) I'm understanding correctly, this would only xinclude
    the *first* child of the element named 'foo'. Instead, I want to
    xinclude *all* the children. I would have thought that this
    <xi:include href="firstFile Name" xpointer="foo/*"/>
    would work, but it generates an error:
    XPointer evaluation failed: #foo/*
    All the variants of this that I've tried also fail.

    How do I xinclude all children of the specified element?

    Mike Maxwell
    CASL/ U MD
  • Philippe Poulard

    #2
    Re: xinclude all children

    hi,

    McSwell a écrit :
    I have an XML file that looks something like this:
    ------------------------
    <?xml ...?>
    <!DOCTYPE ...>
    <src:fragment id="foo" ...>
    <Ph:Itemsome stuff </Ph:Item>
    <Ph:Itemsome more stuff </Ph:Item>
    ...
    <Ph:Itemstill more stuff </Ph:Item>
    </src:fragment>
    ----------------------
    >
    I want to xinclude all the children of the root element into another
    XML file. I've been trying things like
    <xi:include href="firstFile Name" xpointer="foo/1"/>
    Provided that your XInclude engine support them, you can use the
    xpointer() scheme from the XPointer framework ; usually, tools that
    support them only support XPath, or a subset of XPath

    If I don't make mistakes, try this :
    <xi:include href="firstFile Name" xpointer="xpoin ter(/foo/node())"/>
    ....but I don't remember if the spec doesn't impose limitations such as
    "there must be a single node" :(

    You can try RefleX for performing your XInclusions where XPath is rather
    well supported :

    Here is a basic example with XInclude :


    And the result of the test suite, for DOM and SAX (both are supporting
    XPath)

    However, if(!) I'm understanding correctly, this would only xinclude
    the *first* child of the element named 'foo'. Instead, I want to
    xinclude *all* the children. I would have thought that this
    <xi:include href="firstFile Name" xpointer="foo/*"/>
    would work, but it generates an error:
    XPointer evaluation failed: #foo/*
    All the variants of this that I've tried also fail.
    >
    How do I xinclude all children of the specified element?
    >
    Mike Maxwell
    CASL/ U MD

    --
    Cordialement,

    ///
    (. .)
    --------ooO--(_)--Ooo--------
    | Philippe Poulard |
    -----------------------------

    Have the RefleX !

    Comment

    • McSwell

      #3
      Re: xinclude all children

      On Jul 7, 5:23 am, Philippe Poulard <philippe.poula r...@SPAMinria. fr>
      wrote:
      If I don't make mistakes, try this :
      <xi:include href="firstFile Name" xpointer="xpoin ter(/foo/node())"/>
      Thanks, this appears to be working now!

      (I should have mentioned, I was using xmllint to verify the XML doc.)

      Mike Maxwell
      CASL/ U MD

      Comment

      Working...