openSUSE / suse-xsl

DocBook XSL Stylesheets for SUSE branding
Other
11 stars 10 forks source link

Use pi-attribute template in suse2013/fo/block.xsl #379

Closed tomschr closed 6 years ago

tomschr commented 6 years ago

Problem Description

In file suse2013/fo/block.xsl there is this template:

<xsl:template match="processing-instruction('pdfpagebreak')">
  <xsl:param name="arguments" select="."/>
  <xsl:param name="selected-stylesheets">
    <xsl:choose>
      <xsl:when test="contains($arguments, 'style=&quot;')">
        <xsl:value-of select="normalize-space(substring-before(substring-after($arguments, 'style=&quot;'), '&quot;'))"/>
      </xsl:when>
      <xsl:otherwise>any</xsl:otherwise>
    </xsl:choose>
  </xsl:param>
  <xsl:param name="selected-formatter">
    <xsl:choose>
      <xsl:when test="contains($arguments, 'formatter=&quot;')">
        <xsl:value-of select="normalize-space(substring-before(substring-after($arguments, 'formatter=&quot;'), '&quot;'))"/>
      </xsl:when>
      <xsl:otherwise>any</xsl:otherwise>
    </xsl:choose>
  </xsl:param>
<!-- ... -->
</xsl:template>

The tests and anything in xsl:value-of is not really needed as there is a simpler and more standardized method.

Expected Behaviour

Use the pi-attribute template from the upstream stylesheets, file common/pi.xsl. For example, if your processing instruction looks like this:

<?pdfpagebreak style="bla" formatter="fop"?>

you can get the value inside the pseudo-attribute style like this:

<xsl:template match="processing-instruction('pdfpagebreak')">
  <xsl:variable name="pi-style">
    <xsl:call-template name="pi-attribute">
        <xsl:with-param name="pis" select="."/>
        <xsl:with-param name="attribute">style</xsl:with-param>
    </xsl:call-template>
  </xsl:variable>
  <xsl:variable name="pi-formatter">
    <xsl:call-template name="pi-attribute">
        <xsl:with-param name="pis" select="."/>
        <xsl:with-param name="attribute">formatter</xsl:with-param>
    </xsl:call-template>
  </xsl:variable>
  <!-- Process the variables as needed -->
</xsl:template>