Re: More namespace fun?

Subject: Re: More namespace fun?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 10 Mar 2000 13:51:38 GMT
> I take this to mean I cannot use the namespace axis in a pattern,
> i.e. in an <xsl:template match...

true, just in expressions.

> I used namespace::  Why do I feel I'm about to be told differently  ...

bash-2.01$ grep "namespace::" dp2.xsl
bash-2.01$ 

well grep agrees with me that it isn't used 
(if we are talking about the same file)


change your template to


<xsl:template match="*">
<tag>Namespace:<xsl:choose><xsl:when test="namespace-uri(.)"><xsl:value-of
select="namespace-uri(.)"/>
    </xsl:when>
    <xsl:otherwise> Null namespace</xsl:otherwise>
  </xsl:choose>

<xsl:for-each select="namespace::*">
 NS name: <xsl:value-of select="name(.)"/>
 NS value : <xsl:value-of select="."/>
</xsl:for-each>

</tag>
  <tag>name: <xsl:value-of select="name(.)"/></tag>
  <tag>local-name: <xsl:value-of select="local-name(.)"/></tag>
  <tag>Content: <xsl:value-of select="text()"/></tag>
  <xsl:if test="./*"><xsl:apply-templates/></xsl:if>
</xsl:template>



_then_ you have to use saxon.

Saxon gets it right. xt doesn't (as documented) know about the namespace
axis and xalan (a new version I fetched yesterday) doesn't appear
to support exclude-result-prefixes, and incorrectly includes xmlns:
in the name of the namespace node.


David




</tag>bash-2.01$ saxon dp2.xml dp2.xsl
<?xml version="1.0" encoding="utf-8" ?>

<tag>Namespace:http://ns1.com
 NS name: ns1
 NS value : http://ns1.com
</tag>
<tag>name: ns1:ns-test</tag>
<tag>local-name: ns-test</tag>
<tag>Content: </tag>
<tag>Namespace: Null namespace
 NS name: ns2
 NS value : http://ns2.com


etc etc

bash-2.01$ xt dp2.xml dp2.xsl
file:/users/davidc/xsl/dp2.xsl:31: no such axis
bash-2.01$ 



bash-2.01$ xalan dp2.xml dp2.xsl
========= Parsing file:/users/davidc/xsl/dp2.xsl ==========
Parse of file:/users/davidc/xsl/dp2.xsl took 945 milliseconds
========= Parsing dp2.xml ==========
Parse of dp2.xml took 181 milliseconds
=============================
Transforming...
<?xml version="1.0" encoding="UTF-8"?>
<tag xmlns:ns-test="http://ns1.com";>Namespace:http://ns1.com
 NS name: xmlns:ns1
 NS value : http://ns1.com</tag>
<tag xmlns:ns-test="http://ns1.com";>name: ns1:ns-test</tag>
<tag xmlns:ns-test="http://ns1.com";>local-name: ns-test</tag>
<tag xmlns:ns-test="http://ns1.com";>Content: 

...


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread