[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] upgrading Stylesheets


Subject: Re: [xsl] upgrading Stylesheets
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Fri, 06 Apr 2012 10:43:06 +0100

Changing the version number doesn't suddenly turn your XSLT 1.0 processor into a 2.0 processor. But you do seem to have switched processor as well.

I think the problem is that your stylesheet is using features which aren't defined in either the 1.0 or the 2.0 specification: func:function and func:result look like an EXSLT extension to XSLT 1.0 that was a precursor to xsl:function in the 2.0 specifications. It's likely that your 2.0 processor doesn't support this extension.

Michael Kay
Saxonica

On 06/04/2012 08:03, Szabo, Patrick (LNG-VIE) wrote:
Hi,

I have a bunch of stylesheets that I want to upgrade from 1.0 to 2.0.
So I just changed the version number in the sheet and wanted to debug
from there.
We have one stylesheet that is imported into all of the stylesheets
which imports even more stylesheet where common functions are stored.

Now in 1.0 that worked fine.
Now all of a sudden I get an error that none of the functions there are
found anymore.

Example:

Call a function:

<xsl:variable name="NormMonth"
select="replace(glpc:ReplaceMonthToDigits($Date), ' ')"/>

Function:

<func:function name="glpc:ReplaceMonthToDigits">
	<xsl:param name="date-part" select="/.."/>
	<func:result select="misc:ReplaceMonthToDigits($date-part)"/>
</func:function>

It calls nother function which is in a different stylesheet:

<func:function name="misc:ReplaceMonthToDigits">
		<xsl:param name="date-part" select="/.."/>		
		<xsl:variable name="RetVal">
			<xsl:choose>
				<xsl:when test="contains($date-part,
'Januar')">
					<xsl:value-of
select="replace($date-part, 'Januar', '01.')"/>
				</xsl:when>
				<xsl:when test="contains($date-part,
'Februar')">
					<xsl:value-of
select="replace($date-part, 'Februar', '02.')"/>
				</xsl:when>
				.
				.
				.
				<xsl:otherwise>
					<xsl:value-of
select="$date-part"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		
		<func:result select="replace($RetVal, '..', '.')"/>
	</func:function>

Now both of the stylesheets are imported in the same stylesheet so they
should "find each other" right ?
Yet I get this error:

XPST0017: XPath syntax error at char 40 on line 282 in
{...placeMonthToDigits($Date), ...}:
    Cannot find a matching 1-argument function named
  {http://www.linkwerk.com/namespaces/glpcommon}ReplaceMonthToDigits()

Any suggestions?

Help would be much appreciated.


. . . . . . . . . . . . . . . . . . . . . . . . . . Ing. Patrick Szabo XSLT Developer LexisNexis A-1030 Wien, Marxergasse 25

mailto:patrick.szabo@xxxxxxxxxxxxx
Tel.: +43 1 53452 1573
Fax: +43 1 534 52 146


Current Thread
Keywords