Re: [xsl] XSL and Namespace

Subject: Re: [xsl] XSL and Namespace
From: Johannes Döbler <jd@xxxxxxxxxxxxxx>
Date: Thu, 31 May 2001 00:01:25 +0200

Hi Perry,

> I am using a namespace called "documentation" in my XSL which I process with
> its own XSL to produce html documentation for the XSL file. The following
> code snippet causes an error when using Saxon (both Instant and 6.1),
> telling me that the import tags need to be the first tags after the
> xsl:stylesheet element, however Xalan and MSXML 3 process without error. The
> spec says <xsl:import> has to be the first element but does it have to be
> the first element of all namespaces?


The XSLT Recommendation says:

   "The xsl:import element children must precede all other element
   children of an xsl:stylesheet element, including any xsl:include
   element children."

It doesn't predicate the 'element children' of the xsl:stylesheet
element as being 'XSLT element children' or 'element children in the
XSLT namespace'.  So, strictly, you can't have any other element
children, no matter what namespace, before xsl:import elements.

Cheers,

Jeni

Some more scholastic input from the XSLT spec:


"In addition, the xsl:stylesheet element may contain any element not from the XSLT namespace, provided that the expanded-name of the element has a non-null namespace URI. (...) Thus, an XSLT processor is always free to ignore such top-level elements, and must ignore a top-level element without giving an error if it does not recognize the namespace URI."

So it is an error to put a <documentation:xyz> element before <xsl:import> but the XSLT implementation must ignore the error. But must it ignore only the fact that it does not recognize the namespace URI or can it ignore the element occurring before xsl:import? The later seems quite reasonable to me.

Cheers,
Johannes



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


Current Thread