[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] re: generation of qnames/prefixes in content and value [was xbind:module....]


Subject: Re: [xsl] re: generation of qnames/prefixes in content and value [was xbind:module....]
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Sun, 4 Mar 2001 11:07:50 +0000

Hi Curt,

>> Without the ability to specify prefixes, then an XSLT stylesheet
>> which generates an XSLT stylesheet will be unable to declare script
>> items. Right? Or am I missing something again?
>
> Actually, as far I can tell, it would also prevent the generation of
> any XML application that used qualified names in contexts other than
> tag or attribute names. For example, XML Schema uses attribute
> values containing QNames to refer to types or elements defined in
> other schemas (for example, base="xsd:double") and XSLT 1.1 uses
> QNames to refer to extension behavior in expressions (i.e.
> ="{date:format(@date)}"

You and Clark make a good point about the use of prefixes (and
qualified names) in generated attribute values (or text nodes).
However, I don't think it's a problem as long as the namespaces that
you use are declared in the stylesheet.

If you have a namespace declared in the stylesheet, then any namespace
nodes on a particular literal result element or xsl:element are copied
to the result tree (modulo ones that you exclude with
extension-element-prefixes and exclude-result-prefixes).

For example, if I have my stylesheet:

<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:xsd="http://www.w3.org/2000/10/XMLSchema"
                xmlns:my="my-namespace">

<xsl:template match="/">
   ...
   <xsd:element name="foo" type="my:string" />
   ...
</xsl:template>

</xsl:stylesheet>

Then the namespace nodes for 'xsd' and 'my' prefixes are copied onto
the xsd:element element, so the namespace declaration for the 'my'
namespace will be present in the output, and the value 'my:string'
will be resolved as it should be.

Cheers,

Jeni

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



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



Current Thread
Keywords