Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
| Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 13th, 2005, 09:19 AM
Authorized User
 
Join Date: Oct 2005
Location: , , Philippines.
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Default namespace problem

when a root element has an attribute of namespace like this:
<root xmlns="www.somewhere.com">
...
<somenode>...<somenode>
...
</root>
how come in when I ran my stylesheet on in this xml, it cannot reach the children of the root.
<xsl:template match="/">
 <xsl:apply-templates/>
</xsl:template>
<xsl:template match="*">
 <xsl:element name="name(.)">
  <xsl:copy-of select="@*"/>
  <xsl:apply-templates/>
 </xsl:element>
</xsl:template>
<xsl:template match="somenode">

</xsl:template>
when I debug the process using altova, I can see that it does not really match the node. how come?

 
Old November 13th, 2005, 12:25 PM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

This is a FAQ: see http://www.dpawson.co.uk/xsl/sect2/N...tml#d6476e1012

An unprefixed name in a path expression or match pattern refers to an element in no namespace. To match an element in a namespace, you need to use a prefix, even if it's the default namespace.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference




Similar Threads
Thread Thread Starter Forum Replies Last Post
Namespace problem Harshal123 BOOK: Beginning XML, 4th Ed ISBN: 978-0-470-11487-2 1 October 21st, 2008 06:35 AM
namespace problem gantait XSLT 5 February 19th, 2007 12:51 AM
Namespace Problem JRMotz BOOK: ASP.NET Website Programming Problem-Design-Solution 1 November 12th, 2005 03:18 PM
namespace problem marclena XSLT 1 February 12th, 2004 03:48 PM
Problem with Namespace allenracho BOOK: ASP.NET Website Programming Problem-Design-Solution 2 October 22nd, 2003 11:31 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.