I had time to get rid of the XSL problem that I have.
Basically, I have a mapped template that calls a named template in another XSL file.
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:include href="/_internal/stylesheets/core/common" /> <xsl:template match="system-page"> <div id="main"> <div class="pageHeading"> <h1><system-page-display-name /> </h1> <xsl:if test="current()/dynamic-metadata[name='Printable']/value='true' or current()/dynamic-metadata[name='Shareable']/value='true'"> <xsl:call-template name="shareAndPrint"> <xsl:with-param name="shareable" select="current()/dynamic-metadata[name='Shareable']/value" /> <xsl:with-param name="printable" select="current()/dynamic-metadata[name='Printable']/value" /> </xsl:call-template> </xsl:if> </div> <xsl:copy-of select="current()//system-data-structure/html/node()"/> </div> </xsl:template>
Then, in another file, here is the template that I call:
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:spring="http://www.springframework.org/tags" version="1.0"> <xsl:template name="shareAndPrint"> <xsl:param name="shareable"/> <xsl:param name="printable"/> <div class="shareBar"> <xsl:if test="$printable = 'true'"> <a class="print" href="javascript:window.print();"><spring:message code="print.label" /></a> </xsl:if> <xsl:if test="$shareable = 'true'"> <span class="st_sharethis" id="shareThis"></span> </xsl:if> </div> <xsl:if test="$shareable = 'true'"> <script type="text/javascript">$('#shareThis').attr('displayText','ShareThis');</script> <script src="http://w.sharethis.com/button/buttons.js" type="text/javascript"></script> </xsl:if> </xsl:template>
As you can see, I mainly use XSL to create a JSP file with spring: message tags in it to translate our site.
And my problem basically is that no matter what I do, the XML output always ends up having HTML elements with xmlns: spring = "http://www.springframework.org/tags". I have seen many other posts related to this problem, but it seems that none of the solutions work for me.
Here is an example output:
<div id="main"> <div class="pageHeading"><h1>CR-HTML-Static-WRS-en - test </h1> <div class="shareBar" xmlns:spring="http://www.springframework.org/tags"> <a class="print" href="javascript:window.print();"> <spring:message code="print.label" /> </a> <span class="st_sharethis" id="shareThis" ></span> </div> <script type="text/javascript" xmlns:spring="http://www.springframework.org/tags">$('#shareThis').attr('displayText','ShareThis');</script> <script src="http://w.sharethis.com/button/buttons.js" type="text/javascript" xmlns:spring="http://www.springframework.org/tags" ></script> </div>TEST CR</div>
I tried adding exclude-result prefixes to xsl: stylesheet tags, and although this removes xmlns from the HTML elements, it is added to the spring: tag instead, which will not work if the JSP is parsed (xmlns is an invalid spring: message attribute) . So I'm not sure what I'm doing wrong or what else I can try.
Please, if anyone has any ideas or solutions for this, I would really appreciate it. Sorry if nothing comes of it, I will add it if necessary.
Thanks in advance.