[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: More namespace fun?

Subject: Re: More namespace fun?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 10 Mar 2000 13:51:38 GMT
bash namespace
> 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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.