2012-03-21 120 views
1

中包含sepcfic字符串我正在使用XSLTC#如何檢查標記是否在xslt

我輸入標籤的格式爲像

<td>....</td> 
<td>uma</td> 

我需要td轉換爲entry標記,並檢查它是否包含下列順序... 所以我的輸出將是如下。

如何檢查標籤是否僅包含...並用空白替換。 標籤始終包含...,它是靜態的。

回答

2

請嘗試以下

<?xml version="1.0" encoding="UTF-8"?> 
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> 

    <xsl:template match="/"> 
     <root> 
      <xsl:apply-templates/> 
     </root> 
    </xsl:template> 

    <xsl:template match="td"> 
     <entry> 
      <xsl:if test=". != '...'"> 
       <xsl:value-of select="."/> 
      </xsl:if> 
     </entry> 
    </xsl:template> 

</xsl:stylesheet> 
這個條件
1

您可以檢查使用

td[text() = '...'] 
相關問題