2011-08-25 88 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个标题,所有内容都相同,并且我正确匹配标题并隐藏它,但是没有注意到,因为还有其他两个相同的标题。感谢您的帮助,感激。 –