0
template1 내부에서 template2를 호출하고 template1의 매개 변수를 제공하고 싶습니다.XSLT : 매개 변수를 제공하는 템플릿에서 매개 변수가있는 템플릿 호출
<xsl:template name="template1" match="home/sentences/sentence">
<xsl:if test="something...">
<new_sentence>
<!-- ...other unrelated stuff... -->
<xsl:apply-templates select="key('get_sentence_attribute', tokenRef/@tokID)"/>
<!--Here I point to the template I made for tokens.
But I also wish to provide it with the value returned by get_sentence_attribute -->
<xsl:apply-templates select="../../tokens"/>
</new_sentence>
</xsl:if>
</xsl:template>
<xsl:template name="template2" match="home/tokens">
<!-- ... -->
</xsl:template>
은 기본적으로 내 토큰 템플릿에 의해 선택된 값이, 내 문장 템플릿에 얻을 sentence_attribute 일치하는지 확인해야합니다
는 지금, 나는 이런 식으로 뭔가가있다. 난 주위에 봤 거든 <xsl:with-param>
요소를 발견; 그러나 그것은 나에게 꽤 혼란스럽고 나는 그것이 필요한지 확실하지 않다.
도움 주셔서 감사합니다.
"template1"안에 생성 된 "local"변수를 사용하고 template2에 전달하려고합니다. 그래서'template2' 안에'template1'과'3.'을'1.'과'2.'을 추가해야합니까? "xslt 스타일 시트 분석 실패"가 발생했습니다. – Spectraljump
몇 가지 문제가 있었지만 시행 착오로 모든 문제가 해결되었습니다. 구문 오류가 발생했습니다 :' xsl : call-template />'. 나는 당신의 대답을 받아 들였지만'/>'을 고쳤습니다. 또한 앞으로 답변을 게시 할 때 질문의 샘플 코드를 기반으로 예제로 응답 해보십시오. 그것은 일을 훨씬 쉽게 만든다. – Spectraljump