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

Processing 2 times the same node without copying cont

Subject: Processing 2 times the same node without copying content...
From: "Adam Komisarek" <akakus@xxxxxxxxx>
Date: Fri, 8 Aug 2008 13:56:42 +0200
 Processing 2 times the same node without copying  cont
Hello!

I have following problem: I need to add anchor support for quite big
stylesheets which produce HTML output. So I want to copy @id / add <a
name="{@id}"> to the result tree. But the problem is I can't do it in
this way:

<!-- HTML ANCHORS -->
<xsl:template match="*[@id]" priority="2">
	<a name="{@id}"/>
	
	<xsl:variable name="content">
		<xsl:copy>
			<xsl:apply-templates mode="anchor" select="@*|node()"/>
		</xsl:copy>
	</xsl:variable>
	
	<xsl:apply-templates select="xalan:nodeset($content)"/>
</xsl:template>

<xsl:template match="node()" mode="anchor">
	<xsl:copy-of select="."/>
</xsl:template>

<xsl:template match="@*" mode="anchor">
	<xsl:choose>
		<xsl:when test="name()='id'">	
		</xsl:when>
		<xsl:otherwise>
			<xsl:copy>
				<xsl:apply-templates select="."/>
			</xsl:copy>	
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

Because as far as I know xalan:nodeset changes input tree and that
stylesheet involve counting on preceding elements (to calculate how
many page breaks appeared). So I can't do that way :(.

Is there anyway to apply-templates on self node and ommiting some
attributes? It would be thing I am looking for... Thanks for help!

Regards,
Adam Komisarek

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.