On 02/06/2010 09:22, Gábor Tóth wrote:
Dear All,
Thanks for your answers, Michael I tried it out and it worked,
however, I have not so far managed to install Saxon to my Mac, so as a
temporal solution I am using a Firefox adds-on, called "Get XSLT
results" and it has two options for creating transformations, one is
the Saxon 9B, and the other one is called "Built-in XSLT", if I am
trying with the Saxon 9B option, it does not generate the id for this
Given this source document:
<text>
<w ID=" " >car</w>
<w ID=" ">dog</w>
<w ID=" ">cat</w>
<w ID=" ">house</w>
</text>
and this stylesheet
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0">
<xsl:template match="@*|node()|comment()|processing-instruction()">
<xsl:copy><xsl:apply-templates
select="@*|node()|comment()|processing-instruction()"/></xsl:copy>
</xsl:template>
<xsl:template match="@ID">
<xsl:attribute name="Id">
<countNo><xsl:number count="w"/></countNo>
</xsl:attribute>
</xsl:template>
</xsl:stylesheet>
Saxon produces this output:
<?xml version="1.0" encoding="UTF-8"?><text>
<w Id="1">car</w>
<w Id="2">dog</w>
<w Id="3">cat</w>
<w Id="4">house</w>
</text>
Note, I had to remove the xpath-default-namespace attribute, because
your input is not in a namespace. Perhaps the stylesheet worked with the
Transformiix processor because an XSLT 1.0 processor running a
stylesheet that specifies version="2.0" will ignore the
xpath-default-namespace attribute.
If you're having problems installing Saxon on your Mac, you might find
that "Kernow for Saxon" is easier to install. and use This will
automatically install Saxon as well as Kernow.
Michael Kay
Saxonica
--~------------------------------------------------------------------
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>
--~--