|
Subject: Re: [xsl] xsl:number and including nodes with xsl:key From: Denis Haskin <Denis@xxxxxxxxxxxxxxxxxx> Date: Fri, 29 Aug 2003 10:07:06 -0400 |
<test> <extra myid="extraid"><name>Extra item</name></extra> <item> <name>Item one</name> <name>Item two</name> <name>Item three</name> <insert ref="extraid"/> </item> </test>
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xalan="http://xml.apache.org/xalan" >
<!-- identity transform for copying source tree to interim result tree --> <xsl:template match="@*|node()" name="do-transclusion" mode="copy"> <xsl:copy> <xsl:apply-templates select="@*|node()" mode="copy"/> </xsl:copy> </xsl:template>
<!-- don't output 'extra' nodes to the interim tree; they'll get included
by 'insert' nodes -->
<xsl:template match="extra" mode="copy"/><!-- for 'insert' nodes, insert the content of the specified 'extra' node
instead. -->
<xsl:template match="insert" mode="copy">
<xsl:variable name="d" select="key('testkey',@ref)"/>
<xsl:for-each select="$d/name">
<xsl:copy-of select="."/>
</xsl:for-each>
</xsl:template><!-- identity transform, for testing --> <xsl:template match="@*|node()" mode="normal"> <xsl:copy> <xsl:apply-templates select="@*|node()" mode="normal"/> </xsl:copy> </xsl:template>
<!-- number the name nodes so we can see that numbering now works as we need
it to. -->
<xsl:template match="name" mode="normal">
<xsl:number/> - <xsl:value-of select="."/>
</xsl:template><?xml version="1.0" encoding="UTF-8"?> <test>
<item> 1 - Item one 2 - Item two 3 - Item three 4 - Extra item </item> </test>
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] xsl:number and including , Michael Kay | Thread | Re: [xsl] xsl:number and including , Wendell Piez |
| Re: [xsl] Re: Re: Incrementing a Gl, Mukul Gandhi | Date | [xsl] xsl sort query, Cormac Fiddes |
| Month |