xsl-list
[Top] [All Lists]

RE: XMLNS attribute in the XML source file

2003-07-01 14:40:58
When you refer in your stylesheet to an element such as
{http:\\nowhere\schema\test}test (using the notation {uri}local-name)
then you must use a prefixed QName such as nowhere:test, where nowhere
is a namespace prefix bound to the URI http:\\nowhere\schema\test.

Incidentally, http:\\nowhere\schema\test is not a valid URI, but
namespace names in practice don't have to be valid URIs. URIs always use
forwards slashes.

Michael Kay


-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com 
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of 
Bob Jones
Sent: 01 July 2003 20:43
To: XSL-List(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] XMLNS attribute in the XML source file


I'm trying to figure something out.  I have the following XML file:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type='text/xsl' href='test.xslt'?>
<test xmlns="http:\\nowhere\schema\test">
      <test2>This is a test</test2>
</test>

...with the following XSL stylesheet:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
xmlns:xs="http://www.w3.org/2001/XMLSchema";>
    <xsl:template match="/">
        <html>
            <head />
            <body>
                <xsl:for-each select="test">
                    <xsl:for-each select="test2">
                        <xsl:apply-templates />
                    </xsl:for-each>
                </xsl:for-each>
            </body>
        </html>
    </xsl:template>
</xsl:stylesheet>

...I can't get the stylesheet to work unless I drop the XMLNS 
attribute from 
the XML file (which I really don't want to do).  What do I 
change in the 
XSLT to make it work correctly?

Thanks!

_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>