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

'copying' the default namespace

Subject: 'copying' the default namespace
From: Carl Yu <carl.yu@xxxxxxxxxxxx>
Date: Thu, 16 Jan 2003 14:37:43 -0800 (PST)
carl yu teradyne
I know this has been covered before... and I know that XSLT 2.0 will probably 
have the robust answer, but this XSL generates some interesting behavior.  I 
wonder if any of the XSL gurus can figure out why Xalan would generate this type 
of output.  And, if there's any way around it.

in.xml
--
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<root version="0.1" xmlns="http://www.teradyne.com/test">
   <child/>
</root>

test.xsl
--
<?xml version="1.0"?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:ter="http://www.teradyne.com/test" version="1.0">
<xsl:output method="xml" indent="yes"/>

<!-- IDENTITY copy, exclude failed patterns -->
<xsl:template match="ter:*|@*">
   <xsl:copy>
      <xsl:apply-templates select="ter:*|@*" />
   </xsl:copy>
</xsl:template>

<xsl:template match="ter:root/ter:child">
   <xsl:element name="newChild" />
</xsl:template>

</xsl:transform>

out.xml
--
<?xml version="1.0" encoding="UTF-8"?>
<root xmlns="http://www.teradyne.com/test" version="0.1">
<newChild xmlns:ter="http://www.teradyne.com/test" xmlns=""/>
</root>

So here's the question.  First, what's the deal with the xmlns:"{uri}" and 
xmlns=""?  Second, is there a way to prevent newChild from carrying any kind of 
namespace declaration.  Finally, in my XSLT doc I want to only match against

<root xmlns="http://www.teradyne.com/test">
   <child/>
</root>

my match statement was the utterly redundant "ter:root/ter:child"... there's 
gotta be a better match statement (like "ter:root/child"... which doesn't work.)

-Carl






 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.