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

Re: Accessing every second node, extract and sort th

Subject: Re: Accessing every second node, extract and sort their elements and then not copy the node name
From: christoph.naber@xxxxxxxxxxx
Date: Tue, 29 Jul 2008 10:18:32 +0200
Re:    Accessing every second node
Hello,

> Trying to convert to a XML document into another, I'm trying to
> figure out how to access every second element node from the document
> root, take and sort all their elements according 2 attributes (
> GroupNumber and ElementNumber)

Some stylesheet code and example select statements would have made
figuring out what you want much easier, but I think you want something
like:

<xsl:apply-templates select="/*/*/*" >
        <xsl:sort select="@GroupNumber" />
        <xsl:sort select="@ElementNumber" />
</xsl:apply-templates>

This selects all elements on the third level, that is, all childnodes of
"every second node", imho better indicated as "nodes on the third level".

But what do you mean with

> without copy the name of the second element name.

?

Simply copying the selected nodes to the result document is done with:
<xsl:template match="/*/*/*">
        <xsl:copy>
                <xsl:copy-of select="@*" />
        </xsl:copy>
</xsl:template>

One can achieve this with a for-each loop too, but that isn't the
declarative XSLT way.

Greetings Christoph



If you are not the intended addressee, please inform us immediately that you
have received this e-mail in error, and delete it. We thank you for your
cooperation.

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-2007 All Rights Reserved.