[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Adding an element of a specific type

Subject: Adding an element of a specific type
From: "Hofman, Peter" <peter.hofman@xxxxxxxxxxxxx>
Date: Wed, 18 Oct 2006 15:47:27 +0200
 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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.