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

RE: [xsl] Adding an element of a specific type


Subject: RE: [xsl] Adding an element of a specific type
From: "Geert Josten" <geert.josten@xxxxxxxxxxx>
Date: Wed, 18 Oct 2006 16:29:30 +0200

Hi Peter,

How about adding the xsi namespace to the xsl:stylesheet element?

Kind regards,
Geert

>


Drs. G.P.H. Josten
Consultant



Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665  JZ  Bleiswijk
Tel.: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
www.daidalos.nl
KvK 27164984


De informatie - verzonden in of met dit emailbericht - is afkomstig van
Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit
bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit
bericht kunnen geen rechten worden ontleend.


> Van: Hofman, Peter [mailto:peter.hofman@xxxxxxxxxxxxx]
> Verzonden: woensdag 18 oktober 2006 15:47
> Aan: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Onderwerp: [xsl] Adding an element of a specific type
>
> Hi all,
>
> How do I add an element of a specific type to the output.
>
> This is my input:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <ns1:P xmlns:ns1="somenamespace">
>     <ns1:X>some data</ns1:X>
>     <ns1:O>
>         <ns1:C>
>             ...
>         </ns1:C>
>     </ns1:O>
> </ns1:P>
>
> I want to get the structure below. The schema does not have
> element Q, but only has complexType Q_Type:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <ns1:Q type="ns1:Q_Type" xmlns:ns1="somenamespace">
>     <ns1:C>
>             ...
>     </ns1:C>
> </ns1:P>
>
> I tried something like this, but that does not seem to work:
>
> <xsl:template match="ns1:O">
>     <xsl:element name="ns1:Q">
>        <xsl:attribute name="xsi:type">ns1:Q_Type</xsl:attribute>
>        <xsl:apply-templates select="ns1:C" >
>     </xsl:element>
> </xsl:template>
>
> The processor starts complaining about the namespace of the
> type, which I kind of expected already.
> Haven't got a clue though how to fix this.
>
> (sorry, but I am not sure which processor I have, since it is
> embedded in an existing application)
>
> Best regards,
> Peter
>
>
> 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
Keywords