homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / XML Development
Forum Library, Charter, Moderators: httpwebwitch

XML Development Forum

XSL "attributes"

 9:04 pm on May 3, 2010 (gmt 0)

I have a problem that I can't quite solve, despite diligent digging via google, the W3C, and here on the forums.

I have an XML file that consists of todo items. Each item contains "attributes" that have a name, type, and value. I'm trying to get a sub-set of this information out so that I can display it on a Web page for tracking them. The closest I've gotten so far is a stylesheet that displays ALL the attributes--but I really only want the datedue and title.

Here's a snippet of the XML:

<object type="TODO" id="1">
<attribute name="datecompleted" type="date">292818951.40109300613403320312</attribute>
<attribute name="datedue" type="date">292748400.00000000000000000000</attribute>
<attribute name="title" type="string">Do something</attribute>
<attribute name="identifier" type="string">C6F2D32C-0A5A</attribute>

Here's my utterly failed XSLT:

<xsl:stylesheet version = '1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:template match="/TODO/attribute">
<xsl:value-of select="name()"/>

I can't for the life of me figure out how to get just the two types of attributes (name="title" and name="datedue") out

Help! :-)



 5:35 pm on May 5, 2010 (gmt 0)

Welcome to WebmasterWorld!

learn about XPath Predicates [w3schools.com].




 7:39 pm on May 5, 2010 (gmt 0)

Thanks, that's put me on the right path :-)


 12:25 am on May 7, 2010 (gmt 0)

<pun>you mean, the right XPath?</pun>

heh heh


 12:27 am on May 7, 2010 (gmt 0)

I apologize, that was uncalled for. I'm such a nerd...

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