Re: identity template to filter and modify atributes
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>
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>
<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.
________________________________________________________________________ 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. ________________________________________________________________________
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format