xsl-list
[Top] [All Lists]

Re: [xsl] Attributes disappear in XHTML output

2019-08-30 02:24:23
Hi Mark,

There’s this comment by Radu on Github: https://github.com/dita-ot/dita-ot/issues/2955#issuecomment-388341287

So if you have an importing stylesheet (which I assume you have), you can try to override the default behavior like this:

<xsl:template match="@*[starts-with(name(), 'data-')]" mode="add-xhtml-ns">
  <xsl:copy/>
</xsl:template>

– Gerrit


On 30.08.2019 08:47, Mark Giffin m1879(_at_)earthlink(_dot_)net wrote:
When I do the following simple XHTML output, I can get any attribute I want in the XHTML output:

XML input:
<x>
   <p>Here is my text.</p>
</x>

XSLT:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
     xmlns:xs="http://www.w3.org/2001/XMLSchema";
     exclude-result-prefixes="xs"
     version="2.0">
     <xsl:output method="xml" encoding="utf-8" indent="yes"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";
         doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
     />
     <xsl:template match="/">
         <html> <body>
                <span class="myclass" data-toggle="tooltip" data-placement="bottom">
                     <xsl:apply-templates/>
                 </span>
             </body></html>
     </xsl:template>
</xsl:stylesheet>

But when I run XHTML output with the DITA Open Toolkit v.3.3.2 using this:

       <span class="myclass" data-toggle="tooltip" data-placement="bottom">
         <xsl:apply-templates select="." mode="output-term">
          <xsl:with-param name="displaytext" select="normalize-space($displaytext)"/>
         </xsl:apply-templates>
       </span>

only the @class attribute appears in the output. The data-* attributes are dropped. I've tried using <xsl:attribute> instead of literal text, same result. What would cause this?

Thanks,
Mark


--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit(_dot_)imsieke(_at_)le-tex(_dot_)de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer / Managing Directors:
Gerrit Imsieke, Svea Jelonek, Thomas Schmidt
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>