Subject: RE: [xsl] Namespace missing after transform From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Fri, 8 Sep 2006 13:34:17 +0100 |
You say "When I copy it ...", but you aren't copying it, you are creating a new element that happens to have the same local name as the original. Use <xsl:copy> instead, and all the namespace nodes will be copied automatically. Alternatively, use <xsl:copy-of select="namespace::*"/>. Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: Hofman, Peter [mailto:peter.hofman@xxxxxxxxxxxxx] > Sent: 08 September 2006 12:53 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: [xsl] Namespace missing after transform > > Hi, > > I have difficulties getting all necessary namespaces in the > output while performing XML to XML transformation. > > The source document contains typed elements like this: > > <elem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns:xs="http://www.w3.org/2001/XMLSchema" > xsi:type="xs:short">30</elem> > > When I copy it using the following xsl template the xmlns:xs > reference is missing. > > Template: > > <xsl:template match="elem"> > <xsl:element name="elem"> > <xsl:attribute name="xsi:type" > xmlns:xs="http://www.w3.org/2001/XMLSchema" > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> > <xsl:value-of select="@xsi:type"/> > </xsl:attribute> > <xsl:value-of select="."/> > </xsl:element> > </xsl:template> > > Result: > > <elem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:type="xs:short">30</elem> > > Any ideas how to fix this? > > Additional information: > XSL version: 1.0 > XSLT processor: not sure, I think it is SAX based. Anyway, > problem also occurs with msxsl.exe (version 4.0). > > Kind regards, > > Peter Hofman > > > This e-mail and any attachment is for authorised use by the > intended recipient(s) only. It may contain proprietary > material, confidential information and/or be subject to legal > privilege. It should not be copied, disclosed to, retained or > used by, any other party. If you are not an intended > recipient then please promptly delete this e-mail and any > attachment and all copies and inform the sender. Thank you.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Namespace missing after t, David Carlisle | Thread | Re: [xsl] Namespace missing after t, Florent Georges |
Re: [xsl] Namespace missing after t, David Carlisle | Date | Re: [xsl] Relative path, Abel Braaksma |
Month |