RE: [xsl] Building html links in xml

Subject: RE: [xsl] Building html links in xml
From: "Jackson Zettler" <jacksonzettler@xxxxxxxx>
Date: Wed, 17 Dec 2003 13:07:06 -0500
I don't have a template for <a>.  Do I need a template for <a>?

I have a "for each" product.  I have a template for description.  The
description value is the html anchor tag that I want to render as an html
link, instead of text.  The text displayed for the link is correct, it just
doesn't render as a link.

      <xsl:for-each select="page/product">
      <tr>
       <xsl:if test="position() mod 2 = 0">
        <xsl:attribute name="bgcolor">lightgrey</xsl:attribute>
       </xsl:if>
   
       <td width="33%" class="smallDrillDown"><xsl:apply-templates
select="vendor"/></td> 
       <td class="smallDrillDown"><xsl:apply-templates
select="description"/></td>      
      </tr>
      <xsl:for-each select="./subproduct">
      <tr>
       <xsl:if test="position() mod 2 = 0">
        <xsl:attribute name="bgcolor">lightgrey</xsl:attribute>
       </xsl:if>
       <td width="33%" class="smallDrillDown"></td> 
       <td class="smallDrillDown"><img
src="http://fdm4x.fdm4.com/mac70/spacer.gif"; width="15" height="1"
border="0"/><xsl:apply-templates select="description"/></td>      
      </tr>
      </xsl:for-each>
      
      </xsl:for-each>

With a template for description:

<xsl:template match="description">
 <xsl:value-of select="."/>
</xsl:template>

Jackson

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Andrew Welch
Sent: Wednesday, December 17, 2003 12:18 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] Building html links in xml


> In the example below, I want to show the description for a 
> product as a link.  I have problems with the "<" and ">" and 
> the "&" in the URL. If I don't encode these characters then I 
> get errors, as expected.  However if I encode all of the 
> special characters like they are supposed to be, then my page 
> displays the link as text, not as a link.
> 
> What do I have to do to make the display render as a link and 
> not text.
> 
> I hope that makes sense.

Not really :)

What does your <a> matching template look like?  It should look something
like:

<xsl:template match="a">
  <xsl:copy-of select="."/>
</xsl:template>

Posting some xslt here would help


cheers
andrew

> <product page="1" expand="0x00793820" parent="501">  
> <vendor>Grumbacher</vendor>  <description><a 
> href='/olc/drill-down2.w?parent=501&page=1&expand=0x00793820'
> onclick='top.checkClickFlag();'>MAX ArtistsÂ' Oil 
> Colors</a></description>  <subproduct parent="501">
>   <description>37 ml. Tubes</description>
>  </subproduct>
>  <subproduct parent="501">
>   <description>150 ml. Tube</description>
>  </subproduct>
> </product>
> 
> Jackson

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


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


Current Thread