Re: [xsl] [XML namespaces]

Subject: Re: [xsl] [XML namespaces]
From: Jeff Sese <jeferson.sese@xxxxxxxxxxxx>
Date: Tue, 24 Mar 2009 13:50:32 +0800
The namespace for the prefix 'dc' in the source is different from the stylesheet.

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";;
xmlns:dc="http://url.com";>
<xsl:output method="xml"/>
<xsl:template match="catalog">
       <xsl:for-each select="item">
               <Document>
               <xsl:for-each select="category">
                       <Category><xsl:value-of select="."/></Category>
               </xsl:for-each>
               <xsl:copy-of select="dc:source"/>

here youre copying a node with local-name source in the "http:// url.com" namespace



</Document> </xsl:for-each> </xsl:template> </xsl:stylesheet>

My XML file:

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="spinner2dml.xsl"?>

<catalog
xmlns:dc="http://www.w3.org/";>

<item>
<title>~*Rainbow Guidance*~</title>
<link>http://blog.myspace.com/index.cfm?fuseaction=blog.view&amp;friendID=13345245&amp;blogID=420014399 </link>
<guid>http://blog.myspace.com/index.cfm?fuseaction=blog.view&amp;friendID=13345245&amp;blogID=420014399 </guid>
<pubDate>Fri, 01 Aug 2008 00:04:38 GMT</pubDate>
<dc:source>http://blog.myspace.com/kristindunngalbraith</dc:source>

but in the source, you have a node that has a local-name source but in the "http://www.w3.org"; namespace



<category>Dreams and the Supernatural</category> </item> </catalog>

-- Jeff


Current Thread