I am trying to create an xref and cannot get the correct step number in the reference. I am pointing at the cmd tag because when I point at the step tag, it does not link to a page number. The below code (second set) counts all the preceding cmd tags in the whole document. Is there a way to count only the cmd tags in the current task/topic? I have tried creating variables (shown directly below), and this gets me to the correct task number in the document. From there, I could not get it to count the preceding cmd tags in the task in the CurrTask position. Any help on this is greatly appreciated. <xsl:variable name="Tasks" select="count(preceding::*[contains(@class, ' task/steps ')])" /> <xsl:variable name="CurrTask" select="$Tasks +1" /> <xsl:template match="*[contains(@class, ' task/cmd ')]" mode="retrieveReferenceTitle"><xsl:call-template name="insertVariable"> <xsl:with-param name="theVariableID" select="'Step'"/> <xsl:with-param name="theParameters"> <number> <xsl:value-of select="count(preceding::*[contains(@class, ' task/cmd ')]) + 1"/></number></xsl:with-param> </xsl:call-template> </xsl:template> Alternatively, when I point the xref at the step, and insert <fo:inline id="{@id}"/> and <xsl:call-template name="insertPageNumberCitation"/> at the end of the template, it gives me the page number of the actual xref, not the page number of the step it is pointing at. Thank you.
Count cmd in a specific task for xref
in XSLT/XSL-FO
Posted
I am trying to create an xref and cannot get the correct step number in the reference. I am pointing at the cmd tag because when I point at the step tag, it does not link to a page number. The below code (second set) counts all the preceding cmd tags in the whole document. Is there a way to count only the cmd tags in the current task/topic? I have tried creating variables (shown directly below), and this gets me to the correct task number in the document. From there, I could not get it to count the preceding cmd tags in the task in the CurrTask position. Any help on this is greatly appreciated. <xsl:variable name="Tasks" select="count(preceding::*[contains(@class, ' task/steps ')])" /> <xsl:variable name="CurrTask" select="$Tasks +1" /> <xsl:template match="*[contains(@class, ' task/cmd ')]" mode="retrieveReferenceTitle"><xsl:call-template name="insertVariable"> <xsl:with-param name="theVariableID" select="'Step'"/> <xsl:with-param name="theParameters"> <number> <xsl:value-of select="count(preceding::*[contains(@class, ' task/cmd ')]) + 1"/></number></xsl:with-param> </xsl:call-template> </xsl:template> Alternatively, when I point the xref at the step, and insert <fo:inline id="{@id}"/> and <xsl:call-template name="insertPageNumberCitation"/> at the end of the template, it gives me the page number of the actual xref, not the page number of the step it is pointing at. Thank you.