How to check the value of page number in PD4ML in html, xslt?



I am trying to check the value of the page number, but I cannot do that, I can only write it to the PDF. Here is my code, in the footer there is a $[page] variable, which can write the value of the actual page number:



<html xmlns="http://ift.tt/lH0Osb" xmlns:pd4ml="http://ift.tt/1tvJp2p" xmlns:xsl="http://ift.tt/tCZ8VR">
<pd4ml:page.footer>
$[page] <!-- prints the value of the actual page number -->
</pd4ml:page.footer>
</html>


If I set this $[page] to an xslt variable, and print it, also works:



<html xmlns="http://ift.tt/lH0Osb" xmlns:pd4ml="http://ift.tt/1tvJp2p" xmlns:xsl="http://ift.tt/tCZ8VR">
<pd4ml:page.footer>
<xsl:variable name="pagecounter">$[page]</xsl:variable>
<xsl:value-of select="$pagecounter" /> <!-- prints the value of the actual page number -->
</pd4ml:page.footer>
</html>


If I write the length of the string to the output, I will get 7. So this 7 length is the length of "$[page]" string:



<html xmlns="http://ift.tt/lH0Osb" xmlns:pd4ml="http://ift.tt/1tvJp2p" xmlns:xsl="http://ift.tt/tCZ8VR">
<pd4ml:page.footer>
<xsl:variable name="pagecounter">$[page]</xsl:variable>
<xsl:value-of select="string-length($pagecounter)" /> <!-- prints "7", so the length of: "$[page]" -->
</pd4ml:page.footer>
</html>


How could I check the number of the $[page] variable in PD4ML page footer? I tried something like this, but did not work:



<html xmlns="http://ift.tt/lH0Osb" xmlns:pd4ml="http://ift.tt/1tvJp2p" xmlns:xsl="http://ift.tt/tCZ8VR">
<pd4ml:page.footer>
<xsl:variable name="pagecounter">$[page]</xsl:variable>
<xsl:if test="$pagecounter=10()"> <!-- won't work even if the page number is 10 -->
<xsl:value-of select="'this is the 10th page!'" />
</pd4ml:page.footer>
</html>

No comments:

Post a Comment