XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
RE: [xml-dev] problem with simple xsl/xml

XSLT questions are best asked on the xsl-list at mulberrytech.com
 
Your problem is that your context element is a <book>, which does not have attributes called name or link. I suspect that you should replace select="@name" with select="title[@ISBN='name']" - but I'm guessing as to what your intention was.
 
Michael Kay
http://www.saxonica.com/


From: Dave Nixon [mailto:danix@sky.com]
Sent: 30 April 2008 01:02
To: xml-dev@lists.xml.org
Subject: [xml-dev] problem with simple xsl/xml

Hi

I’m having a problem rendering an xml file with xslt. I cannot seem to find the correct syntax to pick up the name and link attributes separately.

Could anyone please provide any guidance.

 

TIA

Dave

 

Xml

 

<?xml version="1.0"?>

<?xml-stylesheet type="text/xsl" href="test.xsl"?>

<books>

   <book> 

        <title ISBN="name" >aaaaaaaaaaaaaaaaaaaaaaa</title>

        <title ISBN="link" >bbbbbbbbbbbbbbbbbbbbbbbbbb</title>

                               

               

   </book>

  

</books>

 

Xsl

 

<?xml version="1.0"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="html" encoding="UTF-8"/>

<xsl:template match="/">

<html>

<head><title>Books</title>

</head>

<body>

<table width="100%" border="1">

 <THEAD>

   <TR>

     <TD width="40%"><B>Name</B></TD>

     <TD width="10%"><B>Link</B></TD>

   </TR>

 </THEAD>

 <TBODY>

   <xsl:for-each select="books/book">

     <xsl:sort select="title/@ISBN" />

    

   <TR>  

     <TD width="40%"><xsl:value-of select="@name" /></TD>  

     <TD width="10%"><xsl:value-of select="@link" /></TD>

   </TR>

  </xsl:for-each>

 </TBODY>

</table>

</body>

</html>

</xsl:template>

</xsl:stylesheet>

 


Internal Virus Database is out-of-date.
Checked by AVG.
Version: 7.5.519 / Virus Database: 269.23.0/1382 - Release Date: 16/04/2008 17:34



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS