Re: [xsl] Generating XSLT

Subject: Re: [xsl] Generating XSLT
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 15 Nov 2004 20:45:41 -0500
At 2004-11-15 16:46 +0100, Geert Josten wrote:
<xsl:namespace-alias stylesheet-prefix="out" result-prefix="xsl"/>

See, now that is just *clever*, that makes it a lot easier. :-)

It sure is, but still quite silly that only the namespace is renamed and not the prefixes as well. In other words, just renaming the prefixes _instead_ of the namespaces would have been nicer...

It has been tried and failed.


If you don't preserve the prefix then when you use the target prefix in an attribute value (and the processor doesn't know which attribute values are qnames that require namespace prefix transliteration), then you end up with a disconnect. Your emitted stylesheet includes namespace prefix uses without a resolved namespace URI.

"In the early days" (tomorrow is the 5th anniversary of XSLT/XPath 1.0!) there were processors that emitted arbitrary namespace prefixes in the result tree and my stylesheets for writing stylesheets didn't work.

Yes, I know the spec doesn't oblige the processor to use the authored prefix, but I cannot see any other way. Even if you hardwire the processor to recognize output XSLT and transliterate only the namespace prefixes found in there in context (awkward at best), that disenfranchises other existing and future vocabularies that will need to have the output namespace bound for attribute value usage.

If the processor uses an arbitrary namespace prefix, it will never know which values in the result tree are QNames.

But if the processor uses the authored namespace prefix, then the author of the stylesheet has an assurance that the use of QNames arbitrarily in the result will have bound prefixes.

I hope this helps.

............................ Ken


-- World-wide on-site corporate, govt. & user group XML/XSL training. G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal

Current Thread