超链接列名称通过Xsl

时间:2013-03-11 08:20:53

标签: sharepoint xslt xslt-1.0

我有文件库,其中ColumnName是Name,数据是超链接到Documents。     我想通过xslt访问它。     List appears like given below     After applying xsl should appear like this but right now i am able to populate the Name.Where as my current requirement is. it should be hyperlinked to the corresponding document

My xsl code is given below:
<xsl:stylesheet version="1.0"
              xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
              xmlns:msxsl="urn:schemas-microsoft-com:xslt"
              exclude-result-prefixes="msxsl" xmlns:ddwrt2="urn:frontpage:internal">
  <xsl:output method='html' indent='yes'/>    
  <xsl:template match='dsQueryResponse'>
    <table cellpadding="10" cellspacing="0" border="1" style="padding:25px;">    
      <tr>
        <td colspan='2'>
          <b style="font-size:25px;">NewsLetter List</b>
        </td>        
      </tr>
      <xsl:apply-templates select='Rows/Row'/>
    </table>
  </xsl:template> 

  <xsl:template match='Row'>   
    <tr>
      <td>
        <table width="100%" border="0" cellspacing="1" cellpadding="1">
          <tr>
            <td>
              <b>
                <img src="../PublishingImages/newsletter_icon.png" width="20px" height="20px"></img>
              </b>
              </td>
            <td>
                <xsl:value-of select="@Name"/>
            </td>
          </tr>

      </table>     
      </td>
    </tr>    
  </xsl:template>
</xsl:stylesheet>

1 个答案:

答案 0 :(得分:0)

假设源XML包含默认情况下可用的相同属性,您可以尝试替换它:

<td>
  <xsl:value-of select="@Name"/>
</td>

有了这个:

<td>
  <a href="{@FileRef}">
    <xsl:value-of select="@Name"/>
  </a>
</td>