I'm using dita-ot 2.4. I need to add a new element into my document. It's supposed to be transformed into a set of different elements through XSL transformations. I have created a plugin which defines a new element and its attributes, and adds it into existing topic template. I have also added some basic XSL processing into an output processing plugin:
<xsl:attribute-set name="rootelement">
<xsl:attribute name="font-weight">bold</xsl:attribute>
</xsl:attribute-set>
<xsl:template match="rootelement">
<fo:inline xsl:use-attribute-sets="rootelement">
<xsl:call-template name="commonattributes"/>
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
So, now I can write the following in my document and it will appear in bold (in PDF):
<rootelement>
test
</rootelement>
However, what I was initially aiming for is to create a transformation for <rootelement>
which would emit other elements, for example, like this:
<xsl:template match="rootelement">
<b>Some text:</b>
<xsl:value-of select="current()" />
<i>Some other text</i>
</xsl:template>
The actual transformation is a bit more complex and involves tables, so I can't just apply display attributes to this element.
Here is a piece of stylesheet that seems to work:
<xsl:template match="rootelement">
<xsl:text>
Text:
</xsl:text>
<fo:inline xsl:use-attribute-sets="rootelement">
<xsl:call-template name="commonattributes"/>
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
Every instance of rootelement
is prepended with "Text: ".
This stylesheet, on the other hand, does not produce expected results:
<xsl:template match="rootelement"> <i> <xsl:text> Text: </xsl:text>
<xsl:apply-templates/>
</i> <fo:inline xsl:use-attribute-sets="rootelement"> <xsl:call-template name="commonattributes"/> <xsl:apply-templates/> </fo:inline> </xsl:template>
The "Text: " part instead of being printed in italics just disappears. Moreover, just putting <rootelement><i>Text: </i> some text</rootelement>
in the source XML works as expected (rootelement content includes %basic.ph).
What am I missing? I have read this tutotial and couldn't notice any key differences. I have also checked the _MERGED.xml file, and any elements I add in my XSLT transformation just disappear.
--
You received this message because you are subscribed to the Google Groups "DITA-OT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dita-ot-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to dita-ot-user...@googlegroups.com.