Copy link to clipboard
Copied
Morning all,
I've been trying to do setup stuff for 2015 for importing XMLs (up until now i've just been playing around with existing books in 2015) and i'm getting some issues with the stylesheet trhowing up errors, some of them are mapping/linking dtd locations but i'm not too fussed on them. one i've got thats causing me a bit of issue is:
XSLT Processor Messages
Fatal Error at file C:\AM\Application\OG-Import.xsl, line 1438, char -1, Message: Arithmetic operator is not defined for arguments of types (xs:string, xs:decimal)
Arithmetic operator is not defined for arguments of types (xs:string, xs:decimal)
The section is question being:
<xsl:template name="Get-size">
<xsl:param name="length"/>
<!-- Get the number part by blanking out the units part and discarding white space. -->
<!--xsl:variable name="number" select="normalize-space(translate($length, '+-0123456789.abcdefghijklmnopqrstuvwxyz', '+-0123456789.'))"/-->
<xsl:variable name="number" select="normalize-space(translate($length, '+-0123456789 abcdefghijklmnopqrstuvwxyz', '0123456789'))"/> (Offending article)
<!-- Get the units part by blanking out the width part and discarding white space. -->
<xsl:variable name="units" select="normalize-space(translate($length, 'abcdefghijklmnopqrstuvwxyz+-0123456789.', 'abcdefghijklmnopqrstuvwxyz'))"/>
<!-- Output the length, translated into mm -->
<xsl:variable name="length-in-mm">
<xsl:choose>
<xsl:when test="$units='cm'">
<xsl:value-of select="$number * 10"/>
</xsl:when>
<xsl:when test="$units='mm'">
<xsl:value-of select="$number"/>
</xsl:when>
<xsl:when test="$units='in'">
<xsl:value-of select="$number * 25.4"/>
</xsl:when>
<xsl:otherwise>
<!--Assume 300dpi for pixels -->
<xsl:value-of select="$number * 25.4 div 300"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="format-number($length-in-mm, '#.00')"/>
</xsl:template>
The xsl is a carryover from what previous author used so i didn't create it, but this is the exact xsl being referenced for import in my FM11, and just works. as far as i can tell, any other import stuff is also identical between the two so, um, help?
As a stop gap, as i'm sorting out with finance to fund the full license, when i upgrade to the full 2015, does that remove my 11 license, as in the interim i can create books in 11 and work on them in 2015. not the ideal solution, but going to be a bit stuck otherwise. Dare say the style sheet could do with an update but as i've not done one before that may take some time.
Cheers
Copy link to clipboard
Copied
Hi stevet93033604,
I don't know an exact answer, but I do know that Adobe changed the default XML/XSLT processor in FM2015 (first patch) from Xalan to Saxon. This was apparently done to support XSLT 2.0. Maybe this is the source of the problem... Saxon doesn't like your stylesheet. Here was the announcement:
FrameMaker (2015 release) – Update 1 released – TechComm Central by Adobe
Fortunately, they put the option to use either processor in maker.ini. Are you familiar with working in that file? I would recommend you go to the following area and put the XALAN line first, in order to make it the default:
[XSLTProcessors]
I would try this before messing with the stylesheet.
Russ
Copy link to clipboard
Copied
HI Russ,
Gave that a try this morning, and no joy, XALAN was already in the first line, same as the maker file in my 11 (Assume its the file in this location C:\Program Files (x86)\Adobe\AdobeFrameMaker11 ?). tried swapping it around so SAXON was first, just in case but still threw up the same error.
Any other suggestions are welcome
Thanks
Steve
Copy link to clipboard
Copied
The code you have supplied should be doing the following:
The error message you are getting is "Arithmetic operator is not defined for arguments of types (xs:string, xs:decimal)". This is because you are passing a string to an arithmetic operator, but the operator is expecting a number. I suspect the statements where the number variable is used to set the length-in-mm variable. for example:
<!-- Output the length, translated into mm -->
<xsl:variable name="length-in-mm">
<xsl:choose>
<xsl:when test="$units='cm'">
<xsl:value-of select="$number * 10"/>
If $number is a string, it would generate the error you are seeing
This is the code that sets the number variable
<xsl:variable name="number" select="normalize-space(translate($length, '+-0123456789 abcdefghijklmnopqrstuvwxyz', '0123456789'))"/>
It incorrectly does the following:
An alternative version of this line is commented out:
<!--xsl:variable name="number" select="normalize-space(translate($length, '+-0123456789.abcdefghijklmnopqrstuvwxyz', '+-0123456789.'))"/-->
This strips any lowercase a-z and is more likely to be correct.
I'd suggest backing up your current version, and then trying the following change at the start:
<xsl:template name="Get-size">
<xsl:param name="length"/>
<!-- Get the number part by blanking out the units part and discarding white space. -->
<xsl:variable name="number" select="normalize-space(translate($length, ' abcdefghijklmnopqrstuvwxyz', ''))"/>
<!-- Get the units part by blanking out the number part and discarding white space. -->
<xsl:variable name="units" select="normalize-space(translate($length, ' +-0123456789.', ''))"/>
<!-- Output the length, translated into mm -->
It does essentially the same, but is easier to understand and maintain.
Copy link to clipboard
Copied
No joy again i'm afraid, Don't suppose it would need any other characters sets or anything like that to be added to the a-z that were introduced in 15? Or setting numbers as LTR/RTL?
Otherwise the same error should have thrown up in 11? With the fixes you've pointed out sorted, think the missing +- might have been me. makes sense now looking at the logic.
Copy link to clipboard
Copied
HAHA!!
changed the number variable to
<xsl:variable name="number" select="number(normalize-space(translate($length, ' abcdefghijklmnopqrstuvwxyz', '')))"/>
Seems to have fixed it
Cheers for the help, pointed me in teh right direction. been i while since i had to do tis osrt of thing