Subject: [xsl] Avoiding Namespace Declarations in Output From: "rowan@xxxxxxxxxxxxxxxxxxxxx" <rowan@xxxxxxxxxxxxxxxxxxxxx> Date: Tue, 22 Sep 2009 12:36:00 -0400 |
Hi, Can someone help me with whats no doubt a very simple problem. How do I avoid unwanted namespace declarations appearing in output from XSLT created by xsl:copy-of? For example, if my input file is: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <menu xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <item> <ObjectType>MI</ObjectType> <Caption>Breakfast Menu</Caption> <Title>Select the item you want...</Title> <NagDelay>15</NagDelay> <Hidden>0</Hidden> <PLU>0</PLU> <FulfilmentArea>0</FulfilmentArea> <ItemType>0</ItemType> </item> <item> <ObjectType>SI</ObjectType> <Caption>Toasted Bacon & Cream Cheese Bagel</Caption> <Title/> <NagDelay>25</NagDelay> <Hidden>1</Hidden> <PLU>TB_MA_BK_01</PLU> <FulfilmentArea>0</FulfilmentArea> <ItemType>0</ItemType> </item> </menu> And my XSL file is: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs" version="2.0"> <xsl:output method="xml" indent="yes"/> <xsl:template match="item"> <xsl:choose> <xsl:when test="ObjectType='MI'"> <Category> <Caption> <English><xsl:value-of select="Caption"/></English> </Caption> <Title> <English><xsl:value-of select="Title"/></English> </Title> <xsl:copy-of select="NagDelay"/> <xsl:copy-of select="Hidden"/> </Category> </xsl:when> <xsl:when test="ObjectType='SI'"> <SalesItem> <xsl:attribute name="plu"><xsl:value-of select="PLU"/></xsl:attribute> <DynamicAttributes> <xsl:copy-of select="FulfilmentArea"/> <ItemType>Item</ItemType> </DynamicAttributes> <Caption> <English><xsl:value-of select="Caption"/></English> </Caption> </SalesItem> </xsl:when> </xsl:choose> </xsl:template> </xsl:stylesheet> My output is: <?xml version="1.0" encoding="UTF-8"?> <Category> <Caption> <English>Breakfast Menu</English> </Caption> <Title> <English>Select the item you want...</English> </Title> <NagDelay xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">15</NagDelay> <Hidden xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">0</Hidden> </Category> <SalesItem plu="TB_MA_BK_01"> <DynamicAttributes> <FulfilmentArea xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">0</FulfilmentArea> <ItemType>Item</ItemType> </DynamicAttributes> <Caption> <English>Toasted Bacon & Cream Cheese Bagel</English> </Caption> </SalesItem> How do I get rid of those untidy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" attributes? This was done with Oxygen, which was using Saxon-B. Thanks - Rowan -------------------------------------------------------------------- mail2web.com - Microsoft. Exchange solutions from a leading provider - http://link.mail2web.com/Business/Exchange
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] parsing entity references, a kusa | Thread | Re: [xsl] Avoiding Namespace Declar, G. Ken Holman |
Re: [xsl] parsing entity references, G. Ken Holman | Date | Re: [xsl] Avoiding Namespace Declar, G. Ken Holman |
Month |