all groups > dotnet xml > july 2006 >
You're in the

dotnet xml

group:

New to xml - what's wrong with my transform


Re: New to xml - what's wrong with my transform Sergey Dubinets
7/21/2006 2:47:11 PM
dotnet xml:
<xsl:for-each select="siteMapNode[@location = 'top']">

[quoted text, click to view]

New to xml - what's wrong with my transform -D-
7/21/2006 4:25:56 PM
I'm trying to write my xsl to display an unordered list fromt the xml file
where location is equal to top:

<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="~/index.aspx" title="Home" location="top">
<siteMapNode url="~/about_us/index.aspx" title="About Us" location="top" >
<siteMapNode url="~/about_us/mediaroom.aspx" title="Media Room" />
<siteMapNode url="~/about_us/awards.aspx" title="Awards" />
<siteMapNode url="~/about_us/employment.aspx" title="Employment
Opportunities" />
<siteMapNode url="~/about_us/events.aspx" title="Trade Show Calendar" />
<siteMapNode url="~/about_us/partners.aspx" title="Partners and Alliances"
/>
<siteMapNode url="~/about_us/wrcmedia.aspx" title="WRC Media" />
</siteMapNode>
<siteMapNode url="~/contact.aspx" title="Contact Us" location="top" />
<siteMapNode url="http://www.mysite.com" title="Customer Support"
location="top" />
<siteMapNode url="~/sitemap.aspx" title="Site Map" location="top" />
</siteMap>

xsl:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<ul>
<xsl:for-each select="siteMapNode/location/top">
<li>
<a href="{@url}"><xsl:value-of select="@title"/></a>
</li>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet>


Re: New to xml - what's wrong with my transform -D-
7/21/2006 4:43:41 PM
The transform is still not displaying? Can I use xsl transform on the
default web.sitemap file provided with asp.net 2.0?


[quoted text, click to view]

Re: New to xml - what's wrong with my transform Martin Honnen
7/22/2006 2:29:20 PM


[quoted text, click to view]


[quoted text, click to view]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
You have a namespace declaration here for which you need to account in
your stylesheet and in your XPath expressions and match patterns
[quoted text, click to view]

xmlns:sm="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0"


[quoted text, click to view]

<xsl:for-each select="ms:siteMap/ms:siteMapNode[@location = 'top']">

--

Martin Honnen --- MVP XML
Re: New to xml - what's wrong with my transform Sergey Dubinets
7/24/2006 9:34:00 AM
XML you posted is not well formed.

Some siteMapNode are children of other siteMapNode. If you don't want
preserve this hierarch try:
<xsl:for-each select="//siteMapNode[@location = 'top']">

Sergey

[quoted text, click to view]

AddThis Social Bookmark Button