当前位置: 动力学知识库 > 问答 > 编程问答 >

How to convert a text in xml to a hyperlink in html using xslt

问题描述:

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>

网友答案:

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>
网友答案:

Or shortly:

<a href="{Filepath}">File</a>
分享给朋友:
您可能感兴趣的文章:
随机阅读: