Sign Up
Search
Options
search
Chat
Help
News
Log in
Not Logged in
Home
»
Boards
»
Stylus Studio Developer Network
»
XSLT Help and Discussion
»
XSLT problem with xmlns
Topic
Topic Page
1
2
3
4
5
6
7
8
9
Prev Topic
Next Topic
next
Subject:
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
top
Subject:
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
Prev Topic
Next Topic
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 to Conference:
Select Conference
Stylus Studio Feature Requests
Stylus Studio Technical Forum
Website Feedback
XSLT Help and Discussion
XQuery Help and Discussion
Stylus Studio FAQs
Stylus Studio Code Samples & Utilities
Stylus Studio Announcements
go
Log In Options
Username:
Password:
Site Map
|
Privacy Policy
|
Terms of Use
|
Trademarks
Stylus Scoop XML Newsletter:
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.