|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Template priority problem
> > When people come to this list and say that a template
> > isn't matching when they expect it to, the most common
> > reason is that the elements are in a namespace (typically
> > a default namespace). You haven't shown us the source
> > document, so that's just a guess.
>
> Yes of course you are right. Damn Default namespace. Whats
> the best approach to solve my problem when all elements in
> the input XML are in a non-blank default namespace? I am
> thinking this may screw up the identity transform template.
No, it doesn't affect the canonical identity transformation. However, it
does affect the specialized templates you add to modify the identity
transformation:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:foo="http://www.foo.com/foo">
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="foo:field">
<!-- Here's where we should do something special... -->
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Some other comments:
1. "@* | node()" is a less verbose version of "* | comment()
| text() | processing-instruction() | @*"
2. The priority attribute you are using are not necessary. In most cases,
the default priorities for match patterns are sufficient.
3. Default namespaces may also affect the XPath expressions you use in
your xsl:variable definitions.
Dave
Dave
|
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
|

Cart








