I have an XML file that I am creating an XSLT transformation for. (XML => HTML)
My XML’s data is defined as:
<Cells>
<Cell Row="0" Col="0" Text="Text here"/>
<Cell Row="1" Col="0" Text="Link <URL URL="http://www.com">here</URL> />
</Cells>
Using XSLT1.0, how can I access the @URL (to get the address) and the “here” for the anchor tag text?
I am using this for my XSLT conditional:
<xsl:choose>
<xsl:when test="contains(@Text, '<URL=')">
<xsl:value-of select="@Text/@URL"/> // DOES NOT WORK
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@Text"/>
</xsl:otherwise>
</xsl:choose>
I am able to correctly detect the URL tag within the ‘Text’ attribute , however I cannot seem to access anything inside of this custom tag by conventional means. My goal is to be able to access the URL param in order to complete the anchor tag in the HTML output.
Change your “link” to an anchor tag instead of a custom format, then just add this property to your value-of tag as follows: