W3C home > Mailing lists > Public > xmlschema-dev@w3.org > November 2004

RE: Getting Namespaces into a Transform

From: Michael Kay <mike@saxonica.com>
Date: Tue, 16 Nov 2004 00:57:08 -0000
To: "'Jim Stanley'" <JimS@Media-Services.Com>, <xmlschema-dev@w3.org>
Message-ID: <S-UTL01-DCPOPAtjfh80001c0ba@dcpop.smtp.stsn.com>

> 
> Hope this isn't too off-topic, but I want to insert a schema reference
> in an XSLT transform.  I need for XML document A to transform to
> document B, and I need the following namespace attributes in the root
> node:
> 
> <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation="NewPPSSchema.xsd" .......>
> 

If you put exactly that in your stylesheet, then you should get exactly that
in your result tree.

It's possible that the XML parser will interpret the
xsi:noNamespaceSchemaLocation attribute as an instruction to validate the
stylesheet against the schema at that location. You should be able to switch
off that interpretation in the parser API, but if you can't, then it may be
safer to generate the attribute using xsl:attribute, or to use a namespace
alias:

<root xmlns:xsia="dummy"
  xsia:noNamespaceSchemaLocation="NewPPSSchema.xsd" .......>

<xsl:namespace-alias stylesheet-prefix="xsia" result-prefix="xsi"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>

You didn't actually say what you attempted and how it is failing.

Michael Kay
Received on Tuesday, 16 November 2004 00:57:10 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 23:40:23 UTC