This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Copying a portion of a subtree in its entirety including retaining the attribute and text info


Hi, I'm new to XSL and I'm trying to figure out how copy an entire
portion of a tree, starting at a sub-node, and includes everything below
that node (node, text, attributes, etc.). I've been able to figure out
how return the nodes or the text using the FAQ section but I haven't
been able to get it to return everything combined. Basically I want the
output to be as if I has just cut the xml out of the file myself and
pasted it elsewhere. Maintaining the white-space characters doesn't
matter to me, just the getting data.

An example of a sample xml input would be as follows:
<Config>
  <Object1>
    <stuff>
        <data/>
    </stuff>
    <Filter>
        <Item>
            <data>
                <mynode dt="mydatatype1"/>
                text
           </data>
        </Item>
     </Filter>
  </Object1>
  <Object2>
    <Filter>
        <Item>
            <data>
                <anothernode dt="mydatatype2"/>
                moretext
           </data>
        </Item>
    </Filter>
  </Object2>
</Config>


For a given Object, which would be denoted by a variable (in this case
Object1), I want to get everything between the 'Filter' tags (including
'Filter') so that the output would be:
<Filter>
    <Item dt=mydatatype>
        <data>
            <mynode dt="mydatatype1"/>
            text
        </data>
     </Item>
</Filter>

I haven't figured out how to get xsl:copy or xsl:copy-of to return this
type of output. How would be the best way to accomplish this. I've tried
both saxon and sablot to get this to work.

Thanks,
Mike Mahoney


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]