I am truly scratching my head with this one. I would like to create a bulleted list with hyperlinks from an XML excerpt. I can create the bulleted list, but I can't work out how to get the part together.
Here is the XML:
<list>
<listitem>1<hyperlink><url>page1.xml</url><name>Go to Page 1</name></hyperlink></listitem>
<listitem>2<hyperlink><url>page2.xml</url><name>Go to Page 2</name></hyperlink></listitem>
<listitem>3<hyperlink><url>page3.xml</url><name>Go to Page 3</name></hyperlink></listitem>
<listitem>4<hyperlink><url>page4.xml</url><name>Go to Page 4</name></hyperlink></listitem>
</list>
...and the XSL so far. The hyperlink components do not work. It may look a bit untidy through my attempts to make it work. I would like the "Go to Page n" to be the hyperlink.
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/TR/REC-html40">
<xsl:output method="html" indent="yes"/>
<xsl:template match="list">
<DIV>
<UL><xsl:apply-templates /></UL>
</DIV>
</xsl:template>
<xsl:template match="listitem">
<DIV>
<LI><xsl:apply-templates /> </LI>
</DIV>
</xsl:template>
<xsl:template match="hyperlink">
<A>
<xsl:value-of select="hyperlink" />
</A>
</xsl:template>
<xsl:template match="hyperlink/url">
HREF='<xsl:value-of select="url" />'
</xsl:template>
<xsl:template match="hyperlink/name">
<xsl:apply-templates />
</xsl:template>
The current result is:
**1. HREF='page1.xml' Go to Page 1
HREF='page2.xml' Go to Page 2
HREF='page3.xml' Go to Page 3
HREF='page4.xml' Go to Page 4 **
What I need is HTML akin to this:
<A HREF='page1.xml'>Go to Page 1</A>
Any help appreciated!