2013-10-10 6 views
1

이 예와 같습니다. https://plone-theming-with-diazo.readthedocs.org/en/latest/snippets_diazo/recipes/index.html#add-attributes-on-the-fly 특정 태그의 모든 클래스를 수정하고 내용을 추가해야합니다. 나는 "navTreeLevel0"클래스와 UL 내부의 리튬 태그에 값이 "노 총알"을 추가 할특정 태그의 속성을 수정하여 값을 추가

<xsl:template css:match="ul.navTreeLevel0 li"> 
     <xsl:attribute name="class"><xsl:value-of select="./@class"/> no-bullet</xsl:attribute> 
    </xsl:template> 

:

이 규칙

작업을 does'nt.

디아 조는 예외를 발생시키지 않습니다. 내가 비슷한 상황을했습니다 같은 규칙 파일에서

하지만,이 경우는 작동합니다

<replace content="//div[contains(@class,'cell')]/@class"> 
    <xsl:attribute name="class"> 
    <xsl:if test='contains(current(),"width-3:4")'>nine large-9 columns</xsl:if> 
    <xsl:if test='contains(current(),"width-2:3")'>height large-8 columns</xsl:if> 
    <xsl:if test='contains(current(),"width-1:2")'>six large-6 columns</xsl:if> 
    <xsl:if test='contains(current(),"width-1:3")'>four large-4 columns</xsl:if> 
    <xsl:if test='contains(current(),"width-1:4")'>three large-3 columns</xsl:if> 
    <xsl:if test='contains(current(),"width-full")'>twelve large-12 columns</xsl:if> 
    </xsl:attribute> 
</replace> 

무슨 일이야? 비토

답변

2

그것은 내가 오늘 읽은이 비슷한 질문에서와 같은 이유가 될 수 있습니다 diazo xsl:template not applying when inside secondary rules file

거기에서 디아 문서를 인용 : "인라인 XSL 지시어는 루트 태그 안에 직접 배치해야하며 무조건 적용됩니다. "

분명히 일부 xsl은 루트 규칙 태그 외부에서 작동하여 코드의 다른 부분이 작동하는 것을 볼 수 있습니다.

코드에서 css:match="..."match="obviously wrong[xsl"으로 바꾸면 Diazo에서 예외가 발생합니까? 그렇지 않은 경우, xsl이 무시되고 루트 역할 태그로 이동해야 할 가능성이 있습니다.

+1

감사의 말입니다. "// * asd []"와 같이 명백하게 잘못된 구문을 넣는 CSS : match 수정 Diazo는 예외 (AssertionError : 예기치 않은 기호 : '/'가 0)를 발생시킵니다. – Vito

+1

내가 작성한 첫 번째 규칙은 기본 rules.xml 파일에 있으며, 두 번째 규칙 (작동하는 하나!)은 이라는 다른 규칙에 있습니다. – Vito