RE: [xsl] Newbie: easy one.

Subject: RE: [xsl] Newbie: easy one.
From: Didier PH Martin <martind@xxxxxxxxxxxxx>
Date: Tue, 08 Jul 2003 10:18:37 -0400
Hi Rudi,

I tried my little utility to check the output of the XSLT stylesheet and
noticed that the template wasn't fired and this is why you get the two links
sitting side by side, they where simply dumped and not processed through
your template.

Here is a modified version that will resolve the problem. It is also simpler
than the original one. Notice that since the current context is on the node
webapps
  |____ website

and since address is a child element of website, we have only to select
"address" elements in the apply-templates.

webapps
  |____ website
           |____ address
           |____ address

 This will create a node list containing only "address" elements. Then,
these nodes could be "matched" against a template associated to "address"
elements.

Hope this will help

OK now its time for my bicycle ride, I have some calories to burn :-)
Cheers
Didier PH Martin
http://didier-martin.com

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:fo="http://www.w3.org/1999/XSL/Format";>

<xsl:template match="/">
<html>
<head><title>Web applications list</title></head>
<body>
<xsl:for-each select="webapps/website">
 <table border="1" summary="Web Application Table">
 <tr>
  <td>Site Name:</td>
  <td><xsl:value-of select="@name"/></td>
 </tr>

 <xsl:apply-templates select="address"/>

 </table>

</xsl:for-each>

</body>
</html>
</xsl:template>

<xsl:template match="address">
 <tr>
  <td>URL:</td>
  <td><xsl:value-of select="."/></td>
 </tr>
</xsl:template>

</xsl:stylesheet>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread