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

Re: identity template to filter and modify atributes

Subject: Re: identity template to filter and modify atributes
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 30 Nov 2010 15:31:43 +0000
Re:  identity template to filter and modify atributes
You need to drop in the new attribute after you have opened the header node, after you have copied the existing attributes but before you copy the children.

You copy the attribute before you start the element node:

Error on line 26 of file:/C:/tmp/col.xsl:
XTDE0410: An attribute node (col) cannot be created after the children of the containing element
Transformation failed: Run-time errors were reported



so move things around to be in this order


		<xsl:copy>		 			 	
<!-- That's the idea, but it doesn't work ... -->

		 	<xsl:apply-templates
select="@*[not(name()='@col')]"/>
'')]"/>
		<xsl:attribute name="col">
			 <xsl:value-of select="$colCount"/>
		</xsl:attribute>




<xsl:apply-templates select="node()[not(key('keyHidden',name()) != '')]"/>


note that not(name()='@col' never does anything as the name is never the string '@col' I expect you mean current()/@col, or something.


also don't do

	<xsl:variable name="colCount">
			<xsl:value-of select="@col - count(col/*[@hide =
1])"/>
		</xsl:variable>
		

do

	<xsl:variable name="colCount" select="@col - count(col/*[@hide =
1])"/>
		

as it's less to type, and a lot more efficient making colCount the number 8 rather than a result tree fragment consisting of a document node with a child text node with string value the serialisation of 8 as a decimal string.

David



________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. ________________________________________________________________________


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.