|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Namespace being carried over
When you use xsl:copy-of, you get an exact copy, namespaces and all.
To satisfy precisely this use case, XSLT 2.0 has introduced an option
copy-namespaces=yes|no that allows you to control this.
In 1.0, the only way to get rid of the namespaces is to do the copy using an
identity template, using xsl:element in place of xsl:copy:
<xsl:template match="*">
<xsl:element name="{local-name()}" namespace="{namespace-uri()}">
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
Michael Kay
> -----Original Message-----
> From: James Paul [mailto:jpaul@xxxxxxxxxxx]
> Sent: 23 August 2004 16:07
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Namespace being carried over
>
> Here is my xslt:
>
> <?xml version = "1.0" encoding = "UTF-8"?>
> <xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"
> version = "1.0" xmlns:ns1 = "http://www.quadrem.com/soap/"
> exclude-result-prefixes = "ns1 ns2 Output" xmlns:ns2 =
> "http://schemas.xmlsoap.org/soap/envelope/" xmlns:Output =
> "java://com.wm.pkg.xslt.extension.Output">
>
> <xsl:output method = "xml" encoding = "utf-8" indent = "yes" />
> <xsl:template match = "*">
> <xsl:copy-of select =
> "ns2:Body/ns1:Body/ns1:Message-Body/*"/>
> </xsl:template>
> </xsl:stylesheet>
>
> Here is the result:
>
> <?xml version="1.0" encoding="utf-8"?>
>
> <Order xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:Q-ENV="http://www.quadrem.com/soap/"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>
> <OrderHeader>
>
> <OrderNumber>
>
>
> <BuyerOrderNumber>DMMV_C84131</BuyerOrderNumber>
>
> </OrderNumber>
>
>
> <OrderIssueDate>20040818T11:10:28-03:00</OrderIssueDate>
>
> <OrderReferences>
>
>
> The problem is this:
> <Order xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:Q-ENV="http://www.quadrem.com/soap/"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>
> Sould look like this:
> <Order>
>
> I don't want all of the namespace information after the Order the tag.
>
> Can anyone help me with this.
>
> Thanks,
> James
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








