1
0
mirror of https://gitlab.gnome.org/GNOME/libxslt synced 2025-09-15 16:01:08 +03:00
Files
libxslt/tests/general/bug-199.xsl
Nick Wellnhofer 8345634c54 Fix <xsl:number level="any"/> for non-element nodes
Fix counting of nodes with <xsl:number level="any"/> when the current
node is a

- comment
- processing instruction
- attribute
- text node
- namespace node

The old code skipped the current node and preceding siblings for these
node types.

Thanks to Martin Honnen for the report. Fixes bug #769756:

https://bugzilla.gnome.org/show_bug.cgi?id=769756
2016-08-13 20:48:59 +02:00

19 lines
630 B
XML

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:for-each select="namespace::a">
<xsl:attribute name="ns">
<xsl:value-of select="."/>
<xsl:text>(</xsl:text>
<xsl:number count="*" level="any"/>
<xsl:text>)</xsl:text>
</xsl:attribute>
</xsl:for-each>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>