This question is part XSL-FO, part XSLT, and part DITA. In general, this question is an attempt to troubleshoot what I am doing wrong with fo:marker and to understand if what I am attempting is possible.
I'm attempting to use fo:marker to store text from a specific element and then retrieve that text in the header like you might expect. I'm doing this as part of a custom style sheet that is part of a DITA plugin. The idea is the plugin is for a document that lists a bunch of steps for procedures. The steps to these procedures generally include a bunch of pictures. So, the requirement is that when a step breaks across a page, the first sentence of the step acts as a running header of sorts. In DITA, the first sentence of a step is captured in a cmd element. So, my thought was I could setup the template that processes cmd elements with an fo:marker.
Here is what the template for cmd looks like with the marker I've added:
<xsl:template match="*[contains(@class, ' task/cmd ')]" priority="1"> <fo:block xsl:use-attribute-sets="cmd"> <xsl:call-template name="commonattributes"/> <xsl:if test="../@importance='optional'"> <xsl:call-template name="insertVariable"> <xsl:with-param name="theVariableID" select="'Optional Step'"/> </xsl:call-template> <xsl:text> </xsl:text> </xsl:if> <fo:inline> <fo:marker marker-class-name="current-step"/> </fo:inline> <xsl:apply-templates/> </fo:block> </xsl:template> This doesn't work. I played around with this a bit and was only able to get this to work on a sibling element to info when I modified the template like this:
<xsl:template match="*[contains(@class, ' task/info ')]"> <fo:block xsl:use-attribute-sets="info"> <fo:inline> <fo:marker marker-class-name="current-step"> <xsl:apply-templates/> </fo:marker> </fo:inline> <xsl:call-template name="commonattributes"/> <xsl:apply-templates/> </fo:block> </xsl:template> The thing is, I tried this construction with the cmd element (i.e. include an apply-templates instruction) and it still produces nothing.
Is what I describe possible and why does my marker only work when I include a apply-templates instruction and only for the info element?
No comments:
Post a Comment