How to convert a text in xml to a hyperlink in html using xslt.
my Xml code is
<Steps>
<Filepath>C:\Test\Capture\050615165617TC001_05_06_1516_57_11.png</Filepath>
</Steps>
to convert it into html my xslt code looks like
<td width='15%'>
<xsl:element name="a">
<xsl:attribute name="href">
<xsl:value-of select="./Filepath"/>
</xsl:attribute>
<xsl:value-of select="./Filepath"/>
</xsl:element>
</td>
Now this code writes the entire path of the file in html, but I want to write only "File" in the html with the hyperlink to the location of the file.
My current generated html code is given below
C:\Test\Capture\050615165617TC001_05_06_1516_57_11.png
<td width="15%"><a href="C:\Test\Capture\050615165617TC001_05_06_1516_57_11.png">C:\Test\Capture\050615165617TC001_05_06_1516_57_11.png</a></td>
What I want is
<td width="15%"><a href="C:\Test\Capture\050615165617TC001_05_06_1516_57_11.png">File</a></td>
Can anyone help me what change I need to do in xslt.
You are telling it to have the value:
<xsl:element name="a">
<xsl:attribute name="href">
<xsl:value-of select="./Filepath"/>
</xsl:attribute>
<xsl:value-of select="./Filepath"/> <!--This is the link text -->
</xsl:element>
So change it to:
<xsl:element name="a">
<xsl:attribute name="href">
<xsl:value-of select="./Filepath"/>
</xsl:attribute>
File
</xsl:element>