2011-08-25 94 views
1

我試圖符合以下條件,並應用樣式到它:如何使用XSLT匹配<titlealts>?

<titlealts>some string in here</titlealts> 

,但我似乎無法得到它。

我能夠匹配以下:

使用

<xsl:template match="p[@outputclass='hiddenMeta']"> 
    <fo:block padding-bottom="0pt" padding-top="0pt" 
      margin-top="0pt" margin-bottom="0pt"> 
    <xsl:apply-templates/> 
    </fo:block> 
</xsl:template> 

<p outputclass="hiddenMeta">Division A</p> 

但我有嘗試匹配像一些簡單的實際困難:

<titlealts>1&#x2003;Definition of parental responsibility (Division A Parental Responsibility and Guardianship)</titlealts> 

我曾嘗試:

<xsl:template name="titlealts"> 
<xsl:template match="titlealts"> 
<xsl:template match="titlealtws[*]"> 

根本沒有運氣,我真的開始覺得自己像是noob。

回答

1

它必須是XSLT中的其他內容阻止匹配工作。模板應該可以工作。

你可以做的是從<titlealts>開始向後通過父/祖,並找到哪個模板阻止了匹配的發生。這可能是因爲您在更高級別的模板中使用了xsl:value-of而不是xsl:apply-templates

+0

這是在我的腦海裏,導致它不工作。我沒有注意到我有3個標題,所有內容都相同,並且我正確匹配標題並隱藏它,但是沒有注意到,因爲還有其他兩個相同的標題。感謝您的幫助,感激。 –