I am trying to pass the xml data to a xslt template using xsl:with-param tag. This is the code:
template:
<xsl:template name="schedule">
<xsl:param name="data" />
<fo:block>
<xsl:value-of select="$data" />
</fo:block>
<xsl:template/>
Call the schedule template
<xsl:call-template name="schedule">
<xsl:with-param name="data"> <xsl:value-of select="//root/scheduleData" /> </xsl:with-param>
<xsl:call-template>
//root/scheduleData -> this contains the xml data. The data received in schedule template is converted to string with only the data present in xml, even the xml tags are removed.
xml data:
<root>
<tag1>567</tag1>
<tag2>456</tag2>
<scheduleData>
<a>12</a>
<b>34</b>
</scheduleData>
<scheduleData>
<a>23</a>
<b>45</b>
</scheduleData>
<scheduleData>
<a>67</a>
<b>89</b>
</scheduleData>
</root>
data printed by this line - <xsl:value-of select="$data" />
is:
1234
2345
6789
Is it possible to send xml data to templates? if its not possible what is the alternate way to achieve this. Thanks for help!
The data received in schedule template is converted to string with only the data present in xml, even the xml tags are removed.
Yes, that's exactly what xsl:value-of
does.
You want
<xsl:with-param name="data" select="//root/scheduleData" />