Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Need XSL list of XML links

Reply
Thread Tools

Need XSL list of XML links

 
 
Donald Firesmith
Guest
Posts: n/a
 
      01-15-2005
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

 
Reply With Quote
 
 
 
 
Joris Gillis
Guest
Posts: n/a
 
      01-15-2005
> <li><a href="<xsl:value-of select="@url"/>">
Make that <li<a href="{@url}">


regards,
--
Joris Gillis (http://www.ticalc.org/cgi-bin/acct-v...i?userid=38041)
Gaudiam omnibus traderat W3C, nec vana fides
 
Reply With Quote
 
 
 
 
Donald Firesmith
Guest
Posts: n/a
 
      01-15-2005
Joris Gillis wrote:
>> <li><a href="<xsl:value-of select="@url"/>">

>
> Make that <li<a href="{@url}">
>
>
> regards,

Joris
Thanks. That works.
Don

 
Reply With Quote
 
anonymous
Guest
Posts: n/a
 
      01-16-2005
Donald Firesmith wrote:
> 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
>


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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
XSL Question tp xsl:for-each and xsl:variable schaf@2wire.ch XML 1 05-27-2005 09:25 PM
tomcal/xsl - problems with xsl:include Klaus Friese Java 0 11-22-2004 10:17 AM
XSL-1000: (Fatal Error) Error while parsing XSL file (org.apache.xerces.parsers.AbstractSAXParser$AttributesProxy) Kevin Flood Java 1 09-13-2004 02:28 PM
XSL-1000: (Fatal Error) Error while parsing XSL file (org.apache.xerces.parsers.AbstractSAXParser$AttributesProxy) Kevin Flood Java 0 09-08-2004 02:11 PM
Creating links with xsl from xml schilde XML 1 02-13-2004 01:21 PM



Advertisments