I would like to call template2 from inside template1, and provide it with a parameter from template1.
Right now, I have something like this:
<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>
Basically I need to make sure that the values selected by my tokens template, match the sentence_attribute I get in my sentence template. I’ve googled around and found the <xsl:with-param> element; but it’s pretty confusing to me and I’m not even sure if it’s what I need.
Thanks for any help!
1 Answer