Finally working with v.15 and while it is generally a good experience, I have so far one technical issue: The output from Web Application Modules (WAMs) is modified, transformed, in an extra step after the XLS transformation.
Case in point: XSL using the XHTML technology service
<?xml version="1.0" encoding="UTF-8"?> <xsl:transform version="1.0" exclude-result-prefixes="lxml wd" xmlns:lxml="http://www.lansa.com/2002/XML/Runtime-Data" xmlns:wd="http://www.lansa.com/2002/XSL/Weblet-Design" xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:import href="std_keys.xsl" /> <xsl:import href="std_variables.xsl" /> <xsl:import href="std_hidden.xsl" /> <xsl:output method="xml" omit-xml-declaration="yes" encoding="UTF-8" indent="no" /> <xsl:template match="/"> <html> <body style="background-color: grey;"> Hello World. </body> </html> </xsl:template> </xsl:transform>
which is possibly the most basic template you can write – I’ve even removed the weblet layout – is transformed to
<html xmlns="http://www.w3.org/1999/xhtml"><body data-style="background-color: grey;"> Hello World. </body></html>
See the differences? There’s an added namespace, (
xmlns="http://www.w3.org/1999/xhtml"), and the
style attribute has been transformed to a
This former happens to the first tag present on the page. The latter is then fixed in the standard
std_script_v2.min.js script, provided this runs – which it doesn’t in the example above, as I’ve removed the default layout.
It is not a problem in most scenarios. I expect most will continue to use WAMs to output web pages to supported browsers, and that’s fine.
The behaviour bothers me on principle. I wrote the transform, but it was transformed by another process that I cannot control. It limits me to generate output that adheres to what Lansa thinks I should be doing.
It also bothers me specifically, as I have for a short while longer, some legacy browsers I’d like to support and the new
std_script_v2.min.js cannot run in those. I’ll probably work a bit on getting
std_script_v2.min.js to run.
EDIT: I think I’ve found the transform that is doing this:
<!-- Change style attribute into data-style for CSP support --> <xsl:template match="@style"> <xsl:attribute name="data-style"><xsl:value-of select="wd:translate(., false())"/></xsl:attribute> </xsl:template>
Obviously it will cause me – and especially the rest of my team – untold pain in the future if I change this but at least it gives us a hint of why it is done. Could it be Content Security Policy? Yes, it appears so. In that case, I’ll accept that it is an elegant solution to a problem that would probably have stumped me, for a while.
I still think I should have the option of using it or not and unlike Web Pages, there are no settings for WAMs so I can’t adjust it.