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

How do I get rid of: xmlns=""

Subject: How do I get rid of: xmlns=""
From: Arthur Maloney <ArthurM@xxxxxxxxxx>
Date: Sat, 3 Jan 2009 17:29:04 +0000
 How do I get rid of: xmlns=""
Hello Xsl-list,

In element <url xmlns=""> How do I get rid of xmlns="" ?
  Other than this code works OK
  Using Xslt v 1.0 in Net Framework
  Transfoming Xml to build Google sitemap.xml

Google specifcation - entity-escaped
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
   <url>
    <loc>http://www.example.com/</loc>
   <lastmod>2005-01-01</lastmod>
    <changefreq>monthly</changefreq>
    <priority>0.8</priority>
   </url>
</urlset>


My output after transform is
<?xml version="1.0" encoding="utf-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url xmlns="">
    <loc>http://www.superDupperSite.co.uk/</loc>
    <changefreq>monthly</changefreq>
    <priority>0.6</priority>
  </url>
... repeats ~ 8,000 times
</urlset>

My Source Xml
<table>
  <row>
    <websiteId>545</websiteId>
    <modified>2008-08-21</modified>
    <Uri>www.superDupperSite.co.uk</Uri>
  </row>
...
</table>

Xslt for transform
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
   <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"
standalone="yes"/>


<xsl:template match="/">
	<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
		<xsl:apply-templates select="table/row"/>
	</urlset>
</xsl:template>

<xsl:template match="row">
   <url>
      <loc><xsl:text>http://</xsl:text><xsl:value-of select="./Uri"/>/</loc>
      <changefreq>monthly</changefreq>
	 <priority>0.6</priority>
   </url>

   <url>
      <loc><xsl:text>http://</xsl:text><xsl:value-of
select="./Uri"/><xsl:text>/About/about.aspx</xsl:text></loc>
      changefreq>monthly</changefreq>
      <priority>0.3</priority>
   </url>

... Repeats for each page in website

</xsl:template>
</xsl:stylesheet>

(Just for completeness) Framework code
Dim UriXslFile As String = Server.MapPath("..\xsl") + "\Sitemap.xsl"
Dim saveTo As String = Server.MapPath("..\sitemap.xml")

Dim cnnStr As String =
ConfigurationManager.ConnectionStrings("AllSites").ConnectionString
Dim spName As String = "dbo.[uspAllSitesMap]"
Dim xdd As XmlDataDocument = AllSites.Dal.XmlHelper.getDataDoc(cnnStr,
spName)


Dim xslt = New XslCompiledTransform()
Dim settings = New XmlWriterSettings()
settings.Indent = True

Dim xw As XmlWriter = XmlWriter.Create(saveTo, settings)
xslt.Load(UriXslFile)
xslt.Transform(xdd, xw)
xw.Flush()
xw.Close()

--
Best regards,
 Arthur                          mailto:ArthurM@xxxxxxxxxx

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.