xsl-list
[Top] [All Lists]

Re: [xsl] Accessing every second node, extract and sort their elements and then not copy the node name

2008-07-29 01:19:07
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.  
--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>