[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Attributes disappear in XHTML output

Subject: Re: Attributes disappear in XHTML output
From: "Mark Giffin m1879@xxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 30 Aug 2019 15:31:22 -0000
Re:  Attributes disappear in XHTML output
This is great, Gerrit, it fixed my problem. Also thanks to Martin for looking at this.

The DITA Open Toolkit had a template that removed my data-* attributes. Unfortunately it did not work to try to override this behavior in the best-practice DITA OT plugin way, so I just commented it out in the default OT code in this file:

dita-ot-3.3.2\plugins\org.dita.xhtml\xsl\dita2xhtml-util.xsl

I'll comment on the bug you mention and maybe the OT guys will fix this.

Mark

On 8/30/2019 12:24 AM, Imsieke, Gerrit, le-tex gerrit.imsieke@xxxxxxxxx wrote:
Hi Mark,

Therebs 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">
B <xsl:copy/>
</xsl:template>


b Gerrit


On 30.08.2019 08:47, Mark Giffin m1879@xxxxxxxxxxxxx wrote:
When I do the following simple XHTML output, I can get any attribute I want in the XHTML output:

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

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


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

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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.