Hi,
Trying to merge some message parts with JS rule file as xsl parameters. Everything is working but special characters.
My code in JS file:
function rule() {
partcount = XQMessage.getPartCount();
paramsHashMap = new java.util.HashMap();
for(i = 0; i < partcount ; i++) {
contentId = XQMessage.getPart(i).getContentId();
if("part1".equals(contentId) || "part2".equals(contentId)) {
esbxmlpart = XQ_getXPath("/", i);
paramsHashMap.put(contentId, esbxmlpart);
}
}
paramsHashMap.put("testHeader", XQMessage.getStringHeader("testHeader"));
paramsHashMap.put("testJsParam", "üõäö");
resultArray = new java.util.ArrayList();
resultArray.add("sonicfs:///workspace/test/testing.xsl");
resultArray.add(new java.lang.Integer(0));
resultArray.add(paramsHashMap);
return resultArray;
}
My code in testing.xsl:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:XQHeaderFunc="java:com.sonicsw.xq.service.xform.HeaderExtension"
xmlns:saxon="http://saxon.sf.net/"
exclude-result-prefixes="XQHeaderFunc saxon"
xmlns:XQMessageElem="http://www.sonicsw.com/sonicxq/com.sonicsw.xq.service.xform.TransformationElementFactory"
extension-element-prefixes="XQMessageElem">
<saxon:script language="java" implements-prefix="XQHeaderFunc" src="java:com.sonicsw.xq.service.xform.HeaderExtension"></saxon:script>
<xsl:output method="xml" omit-xml-declaration="yes" encoding="UTF-8" />
<xsl:param name="part1"/>
<xsl:param name="part2"/>
<xsl:param name="testHeader"/>
<xsl:param name="testJsParam"/>
<xsl:template match="/">
<testing>
<testHeader><xsl:value-of select="$testHeader"/></testHeader>
<testJsParam><xsl:value-of select="$testJsParam"/></testJsParam>
<testContentOne><xsl:value-of select="$part1/testContent"/></testContentOne>
<testContentTwo><xsl:value-of select="$part2/testContent"/></testContentTwo>
</testing>
</xsl:template>
</xsl:stylesheet>
If there are special characters in “testHeader” or in part1 or part2 “testContent” then it prints just some ���� instead.But “testJsParam” is printed correctly like in JS file "üõäö".
If I don’t use JS rule for transformation but only xsl transformation then encoding problem doesn't exists.