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

default namespace and the namespace attribute

Subject: default namespace and the namespace attribute
From: "Huebel, David" <dhuebel@xxxxxxxxxxxxxx>
Date: Fri, 25 May 2001 08:30:02 -0500
default namespace attribute
Joshua, Gareth, thanks for your help!

I've looked at the relevant section of Mike Kay's (excellent) book (page 211
in the second edition), and I haven't been able to solve my main problem.
My stylesheet does not bind the default namespace to a uri, but the element
created by the

<xsl:element name="content">
    ....
</xsl:element>

ends up (in the result document) in the namespace bound to "uri:foo".

Adding the attribute namespace="uri:bar" to <xsl:element> causes the
<content> element in the result document to be in the "uri:bar" namespace,
but if I use namespace="", I get exactly the same result document as if I
exclude the namespace attribute.

I'm afraid I'm missing something simple here -- can someone help?

Once again, I'm using Xalan 1.2.

Thanks,

David

---------------------Source:

<?xml version="1.0"?>
<top xmlns="uri:foo">
    <next name="bar"/>
    <next name="baz"/>
</top>

---------------------Transform:

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

<xsl:template match="po:next">
    <xsl:copy>
        <xsl:value-of select="@name"/>
        <xsl:apply-templates select="*"/>
    </xsl:copy>
</xsl:template>

<xsl:template match="po:top">
    <xsl:copy>
        <xsl:element name="content">
            <xsl:apply-templates select="*"/>
        </xsl:element>
    </xsl:copy>
</xsl:template>

</xsl:stylesheet>

--------------------Result:

<?xml version="1.0" encoding="UTF-8"?>
<top xmlns="uri:foo">
    <content xmlns:po="uri:foo">
        <next>bar</next>
        <next>baz</next>
    </content>
</top>

"Live as if you will die tomorrow - study as if you will live forever."
-- Erasmus 

 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.