RE: [xsl] Generate a List

Subject: RE: [xsl] Generate a List
From: "Scott Trenda" <Scott.Trenda@xxxxxxxx>
Date: Tue, 6 Nov 2007 18:05:08 -0600
I'm guessing that you want something like this:

<xsl:stylesheet version="1.0"

  <xsl:output method="html"/>

  <xsl:template match="head">

  <xsl:template match="list">

  <xsl:template match="item">


<xsl:value-of select="child::item"/> in your "list" template will only
give you the text values of those child nodes. You were missing the HTML
structure. Also, you can omit the <xsl:value-of/> here; the built-in
template for text nodes is to select the value of the node. Just
<xsl:apply-templates/> inside an HTML element in your template.

~ Scott

-----Original Message-----
From: Alice Ju-Hsuan Wei [mailto:ajwei@xxxxxxxxxxx]
Sent: Tuesday, November 06, 2007 5:57 PM
To: xsl-list
Subject: [xsl] Generate a List


  I am trying to use the XSLT to generate something simple like a list
and output it to HTML with <ul> and <li> tags.

This is my XSLT:

  <xsl:template match="head">

<xsl:template match="list">
<xsl:value-of select="child::item"/>


<head>Things to do</head>
<item>Wash the dog</item>
<item>Take out the trash</item>
<item>Check out books on XSLT</item>
<item>Go to the bank</item>
<item>Pay bills</item>


<p class="">Things to do</p>

  Wash the dog Take out the trash Check out books on XSLT  Go to the
bank Pay bills

Can anyone please tell me what is wrong with my code?

Thanks to those who can help.


Current Thread