Displaying links in XML to HTML XSL transform -
i'm working on transforming xml html via xsl , having trouble displaying links. xml looks this:
<c02 level="file"> <did> <container type="box">1</container> <container type="folder">2</container> <unittitle>folder a, </unittitle> <unitdate>2001</unitdate> <daogrp> <daoloc label="image" href="www.test.com" role="image/jpeg"> <daodesc><p>document</p> </daodesc> </daoloc> </daogrp> </did> <scopecontent> <p>1 page</p> </scopecontent> </c02>
my expected html this:
<tr> <td valign="top">1</td> <td valign="top">2</td> <td valign="top" colspan="10">folder a, 2001</td> </tr> <tr> <td></td> <td></td> <td></td> <td></td> <td valign="top" colspan="8"><a href="www.test.com">document<br /> </a></td>
and xsl looks this:
<xsl:template match="daoloc"> <xsl:choose> <xsl:when test="@role='image/jpeg'"> <img src="{@href}" altrender="{@document}"/> </xsl:when> <xsl:when test="@role='new'"> <a href="{@href}"> <xsl:value-of select="@document"/> </a> </xsl:when> </xsl:choose> </xsl:template>
i've played around while little success. how can twist xsl these links display? assistance in advance.
well, following template:
<xsl:template match="daoloc"> <p> <a href="{@href}"> <xsl:apply-templates/> </a> </p> </xsl:template>
applied input (after adding space between label
, href
attributes!), return:
<p> <a href="www.test.com">document</a> </p>
Comments
Post a Comment