XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
will liSubject: XSLT problem with xmlns
Author: will li
Date: 30 Nov 2006 05:13 PM
I'm trying to transform from an xml doc to another xml doc using xsl. For example

xml file:
<c>
<aa>
<a>
<nameid>123</nameid>
<dob>2005-10-10</dob>
</a>
</aa>
<bb>
<b>
<nameid>123</nameid>
<address>blah</address>
</b>
</bb>
</c>

xsl file:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
<xsl:for-each select="/c">
<aa>
<a>
<xsl:copy-of select="aa/a/nameid"/>
<xsl:copy-of select="aa/a/dob"/>
<xsl:copy-of select="bb/b/nameid"/>
<xsl:copy-of select="bb/b/address"/>
</a>
</aa>
</xsl:for-each>
</xsl:template>

</xsl:stylesheet>

Now the above xml and xsl combination works. However, when the xml file has a tag with xmlns like the one below, it doesn't work anymore

<c xmlns="aaa">
<aa>
<a>
<nameid>123</nameid>
<dob>2005-10-10</dob>
</a>
</aa>
<bb>
<b>
<nameid>123</nameid>
<address>blah</address>
</b>
</bb>
</c>

Does anyone have any ideas why?

Thanks

Posttop
Tony LavinioSubject: XSLT problem with xmlns
Author: Tony Lavinio
Date: 01 Dec 2006 01:50 AM
The problem is that you are trying to match an element in namespace "aaa"
but using select again elements in the default namespace.

For a solution, read the XSLT FAQ.

See http://www.dpawson.co.uk/xsl/sect2/N5536.html#d6682e1012 point #23.

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.