homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / XML Development
Forum Library, Charter, Moderators: httpwebwitch

XML Development Forum

Links, For Each, and xml

 2:18 pm on May 18, 2009 (gmt 0)

I am new to xml and having trouble with the code below. The rest of my page works perfectly. I am trying to pull in an external link and an internal link and nothing shows. The internal link text is the NavName attribute and the external link text is the Link attribute.

Does anyone see what I am doing wrong?

Here's the xsl.
<xsl:for-each select="Page">
<a href="@URL"><value-of select="@Link" /></a>
<a href="@URL"><value-of select="@NavName" /></a>
Here's the xml
<Page Name="LinkList" Link="Test" URL="http://www.google.com" />
<Page ID="x1092" Name="LinkList" Link="People & Communities" URL="x1092.xml?Preview=true&Site=&UserAgent=&IncludeAllPages=true&tfrm=4" Title="People & Communities" Abstract="People & Communities" NavName="People & Communities" CreationDate="20090513T14:32:00" Changed="20090513T18:33:10" CategoryIds="" Schema="SectionFront" />



 1:25 am on May 19, 2009 (gmt 0)

1) you need to prepend all XSLT entities with the XSL namespace.


2) invalid XSLT syntax:
<a href="@URL">

should be

<xsl:attribute name="href" value="@URL"/>
<value-of select="@NavName" />

3) <xsl:choose> and <xsl:when> requires a conditional statement (it's analogous to an "if" statement...

W3Schools has some wicked tutorials on XSLT.


 1:30 pm on May 19, 2009 (gmt 0)

welcome to WebmasterWorld!

Take a moment to peruse the Terms of Service [webmasterworld.com], then introduce yourself [webmasterworld.com] to the community.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / XML Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved