Re: [xsl] namespace transform issue

Subject: Re: [xsl] namespace transform issue
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Thu, 19 Apr 2001 08:35:28 +0100
Hi Alex,

> If I switch http://alex.com with
> http://www.w3.org/1999/XSL/Transform, everything works perfectly.
>
> I thought this URL had nothing to do with transforming, but was a
> placeholder for unique names? Is this xalan specific?

Completely the opposite. The namespace URI
'http://www.w3.org/1999/XSL/Transform' is how an XSLT processor
recognises XSLT instructions. If you use a different namespace for
XSLT instructions, then the processor won't recognise them, and
instead think you are using a 'literal result element as stylesheet'
or 'simplified' stylesheet (which is why it's expecting an xsl:version
attribute, something that's mandatory on a simplified stylesheet).

> My code looks like this
>
> <?xml version="1.0" encoding="UTF-8"?>
> <alex:stylesheet xmlns:xsl="http://www.alex.com";
> xmlns:larry="http://www.w3.org/1999/XSL/Transform";  version="1.0">
> <alex:namespace-alias stylesheet-prefix="alex" result-prefix="xsl"/>

Really?!?  You haven't defined the 'alex' prefix anywhere in that
code, so I expect that your XSLT processor would immediately object to
it.  I think you probably mean:

<xsl:stylesheet xmlns:alex="http://www.alex.com";
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                version="1.0">
<xsl:namespace-alias stylesheet-prefix="alex" result-prefix="xsl" />
... stylesheet that creates XSLT instructions in the 'alex'
    namespace ...
</xsl:stylesheet>

Or:

<alex:stylesheet xmlns:xsl="http://www.alex.com";
                 xmlns:alex="http://www.w3.org/1999/XSL/Transform";
                 version="1.0">
<alex:namespace-alias stylesheet-prefix="xsl" result-prefix="alex" />
... stylesheet that creates XSLT instructions in the 'xsl'
    namespace ...
</alex:stylesheet>

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



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


Current Thread