Subject: Re: [xsl] empty namespace declaration being generated From: David Bertoni <david.bertoni@xxxxxxxxx> Date: Tue, 23 Jan 2007 18:46:26 -0800 |
<snip>I apologize for not seeing it in the FAQ. I did search for it before I sent the email (did again after I saw your email), but didn't find anything that looked like what I was seeing. If could give me a url, I'm happy to read it especially if after reading what's below you believe it explains the issue.
I'm using the latest version (2.7.0) of xalan-c, but will be using a MS xslt library in production which I think means I'm stuck at xslt 1.0.
Here's an xsl that demonstrates the problem.
<?xml version="1.0" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" indent="yes" /> <xsl:template match="/"> <stocks xmlns="http://www.fred.com/something"> <xsl:apply-templates select="/Info/Stock" /> </stocks> </xsl:template>
<xsl:template match="Stock" /> <xsl:template match="Stock[Type/@Name='tickerSymbol']"> <security> <xsl:attribute name="exchange"> <xsl:value-of select="substring-before(Name, ':')" /> </xsl:attribute> <xsl:attribute name="ticker"> <xsl:value-of select="substring-after(Name, ':')" /> </xsl:attribute> </security> </xsl:template> </xsl:stylesheet>
Here's the input (there's no namespace declaration in the source file):
<?xml version="1.0" encoding="utf-8"?> <Info> <Stock> <Type Name="category" /> <Name>stocks</Name> </Stock> <Stock> <Type Name="tickerSymbol" /> <Name>NASDAQ:BMET</Name> <Description>Biomet, Inc.</Description> </Stock> <Stock> <Type Name="tickerSymbol" /> <Name>NYSE:JNJ</Name> <Description>Johnson &amp; Johnson.</Description> </Stock> </Info>
The generated output file contains:
<?xml version="1.0" encoding="UTF-8"?> <stocks xmlns="http://www.fred.com/something"> <security xmlns="" exchange="NASDAQ" ticker="BMET"/> <security xmlns="" exchange="NYSE" ticker="JNJ"/> </stocks>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] empty namespace declarati, Scott Smith | Thread | RE: [xsl] empty namespace declarati, Scott Smith |
RE: [xsl] empty namespace declarati, Scott Smith | Date | RE: [xsl] empty namespace declarati, Scott Smith |
Month |