<xsl:template match="p"> not working
Posted: Sun Dec 12, 2010 10:26 pm
I'm writing an xslt transform to number all the <p> tags in a xml document
My initial script below
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl"
exclude-result-prefixes="xd"
version="1.0">
<xsl:template match="p">
<p><xsl:apply-templates select="node() | @*"/>
</p>
</xsl:template>
<xsl:template match="node() | @*" priority="-1">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
However the template match="p" never is entered?
If I add the TEI namespace
xmlns:tei="http://www.tei-c.org/ns/1.0"
and change the template to match="tei:p" it works,
but then it adds the namespace tags to all the initial <p> <s> and <lb> tags which is bad.
Isn't there a way to match the <p> tags without using the tei namespace, or suppress the namespace info in the output file?
My initial script below
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl"
exclude-result-prefixes="xd"
version="1.0">
<xsl:template match="p">
<p><xsl:apply-templates select="node() | @*"/>
</p>
</xsl:template>
<xsl:template match="node() | @*" priority="-1">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
However the template match="p" never is entered?
If I add the TEI namespace
xmlns:tei="http://www.tei-c.org/ns/1.0"
and change the template to match="tei:p" it works,
but then it adds the namespace tags to all the initial <p> <s> and <lb> tags which is bad.
Isn't there a way to match the <p> tags without using the tei namespace, or suppress the namespace info in the output file?