Skip to content

Including specialized attributes in @class values of html5 transformation output #3965

Answered by chrispy-snps
chrispy-snps asked this question in Q&A
Discussion options

You must be logged in to vote

If I apply the following template in an XSLT stylesheet that extends the dita.xsl.html5 extension point:

<!-- add specialized @foo and @bar attributes to @class -->
<xsl:template match="*[@foo or @bar]" mode="set-output-class" priority="10">
  <xsl:param name="default"/>
  <xsl:variable name="orig-class" as="attribute(class)">
    <xsl:next-match>
      <xsl:with-param name="default" select="$default"/>  <!-- get the original @class value -->
    </xsl:next-match>
  </xsl:variable>
  <xsl:attribute name="class" select="$orig-class, @foo, @bar" separator=" "/>  <!-- add specialized attribute values -->
</xsl:template>

then I get the following HTML5 output:

<h1 class="title topictitle1">My…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by chrispy-snps
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants