| re: Need XSL list of XML links
Donald Firesmith wrote:[color=blue]
> How do I use XSL to generate and XHTML list of hyperlinks stored in XML?
>
> My XML contains links of examples of the form:
>
> <examples>
> <example>
> <link url="aURL">some text</link>
> <info>some more text</info>
> </example>
> <example>
> <link url="aURL">some text</link>
> <info>some more text</info>
> </example>
> </examples>
>
> My XSL looks like this:
>
> <ul>
> <xsl:for-each select="examples/example">
> <li><a href="<xsl:value-of select="@url"/>">
> <xsl:value-of select="." disable-output-escaping="yes"/>
> <xsl:value-of select="info"/>
> </a></li>
> </xsl:for-each>
> </ul>
>
> I can't seem to get this to work. The url parameter won't fit in the
> link. Can anyone show me the proper XSL code for this? Also what
> should the XSL code look like if info is optional?
>
> Thanks.
>
> Don
>[/color]
Look into a construct like this:
<a>
<xsl:attribute name="href">
<xsl:value-of select =....../>
</xsl:attribute>
Link text goes here
</a>
Where your @url stuff goes in the value-of section of the attribute. |