Tuesday, August 7, 2012

Debugging XSLT script

To know what is the output of a XSLT function or variable we can simply use <xsl:message> to do a print statement in the xslt transfromation script.

Eg:  In the following template when we do the substring operation we might need to know, what is the input we are getting in our template.

<xsl:template name="FindPhoneNum">
    <xsl:param name="DigitsLength" />
    <xsl:param name="PhoneNum" />
        <xsl:value-of select="$PhoneNum" />
        <xsl:value-of select="$DigitsLength" />
    <xsl:variable name="number">
        <xsl:value-of select="substring($PhoneNum, $DigitsLength -6, $DigitsLength)" />
    <xsl:value-of select="$number" />
Output will be like;

PhoneNum---------: 18168918984
DigitsLength---------: 11

No comments:

Post a Comment