[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Copying a portion of a subtree in its entirety including ret

Subject: Copying a portion of a subtree in its entirety including retaining the attribute and text info
From: Mike Mahoney <mmahoney@xxxxxxxxxx>
Date: Mon, 20 Nov 2000 09:23:52 -0700
mike mahoney
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.