Call templates
Link
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
<xsl:template name="add-X">
<xsl:param name="string" select="." />
<xsl:if test="$string">
<xsl:text>X</xsl:text>
<xsl:value-of select="substring($string, 1,1)"/>
<xsl:call-template name="add-X">
<xsl:with-param name="string"
select="substring($string, 2)" />
</xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Create an file named TEST.xsl with the above code.
<aaaa>ABCDE</aaaa>
Create an file named TEST.XML with the above code.
Create an RTF template with form field valus as
<?import: file:///C:\Desktop\Sample RTF\TEST.xsl?>
Note : here you have to point the xsl path where your TEST.xsl is located.
Then create another form field with value
<xsl:call-template name="add-X"> <xsl:value-of select="." /> </xsl:call-template>
When you merge the xml and RTF , you will find the no of "X" equivalent to length of the string in <aaaa> tag in xml
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
<xsl:template name="add-X">
<xsl:param name="string" select="." />
<xsl:if test="$string">
<xsl:text>X</xsl:text>
<xsl:value-of select="substring($string, 1,1)"/>
<xsl:call-template name="add-X">
<xsl:with-param name="string"
select="substring($string, 2)" />
</xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Create an file named TEST.xsl with the above code.
<aaaa>ABCDE</aaaa>
Create an file named TEST.XML with the above code.
Create an RTF template with form field valus as
<?import: file:///C:\Desktop\Sample RTF\TEST.xsl?>
Note : here you have to point the xsl path where your TEST.xsl is located.
Then create another form field with value
<xsl:call-template name="add-X"> <xsl:value-of select="." /> </xsl:call-template>
When you merge the xml and RTF , you will find the no of "X" equivalent to length of the string in <aaaa> tag in xml
Comments