XSLT Catalog usage

Questions about XML that are not covered by the other forums should go here.
KermitTensmeyer
Posts: 7
Joined: Sat Mar 08, 2008 12:03 am

XSLT Catalog usage

Post by KermitTensmeyer »

I'm running into an issues (off and on), and I think that it's a catalog issue w/ regards to XSL supported name spaces. I examined the frameworks directory to find a pointer to the current catalog, but I didn't find any XSL related schema or DTD information.

I'm assuming that when I don't have a problem, then the parser is fetching the dtd/schema's listed from the authoritative site each time. How do I set up a cache for the common xsl namespace dtd's.

For the most part the Public ID's would be useful, and when I am effectively out of internet access, I would still be able to work if those DTD/schema namespace areas would still be accessible.

F [Saxon9B] XPath syntax error at char 80 on line 66 in {...otd_LL', $motd.replace) els...}:
Cannot find a matching 3-argument function named {http://www.w3.org/2005/02/xpath-functions}replace()

The last time that I checked xpath-functions had two instances of replace. Other times, it would find this function and not be an error. Is there another reason for this other than not being able to examine the namespace catalog?

Kermit Tensmeyer
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: XSLT Catalog usage

Post by sorin_ristache »

Hello,

I see that you use Saxon 9 so I assume you have an XSLT 2.0 stylesheet. From the error message it seems an XPath 2.0 expression is syntactically incorrect in your stylesheet which has no connection with a catalog or the XSLT namespace. If you specify the full XPath expression or better if you post a sample XSLT stylesheet for reproducing the error we can see exactly why you get the error.


Regards,
Sorin
KermitTensmeyer
Posts: 7
Joined: Sat Mar 08, 2008 12:03 am

Re: XSLT Catalog usage

Post by KermitTensmeyer »

OK
with xmlns:config="http://www.suse.com/1.0/configns" xmlns:ns="http://www.suse.com/1.0/yast2ns" xmlns:fn="http://www.w3.org/2005/02/xpath-functions"


<xsl:variable name="content" select="unparsed-text($remote)" />
<xsl:variable name="motd.replace" select="document($cntrl)/SpecLayout/motd"/>
<xsl:variable name="ncontent" select="if (@doc='motd.template') then fn:replace($content,'LL_motd_LL', $motd.replace)
else $content"/>
================================
F [Saxon9B] XPath syntax error at char 93 on line 65 in {...d.replace) else $}:
Cannot find a matching 3-argument function named {http://www.w3.org/2005/02/xpath-functions}replace()


maybe it's just me, but I read xpath-functions as having a replace with the standard 3-argument set up. I don't see the xpath-functions (or any of the xslt v2 dtd in the current catalog.
Perhaps it's using a different lookup method, but it's not finding that function in the current framework.

I read that err message, that it didn't find a function with a specific name and set of arguments in the xmlns lookup for fn, (either in the local cache or remote lookup)

thanks for following up with this
Kermit Tensmeyer
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: XSLT Catalog usage

Post by sorin_ristache »

Hello,

The correct namespace URI for XPath 2.0 functions is http://www.w3.org/2005/xpath-functions. You must use:

Code: Select all

xmlns:fn="http://www.w3.org/2005/xpath-functions"

Regards,
Sorin
KermitTensmeyer
Posts: 7
Joined: Sat Mar 08, 2008 12:03 am

Re: XSLT Catalog usage

Post by KermitTensmeyer »

aHa! :D fixed that problem. thanks..

but a question remains, How does the schema get cached or saved locally when it's not defined in the catalog?
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: XSLT Catalog usage

Post by sorin_ristache »

I do not understand what are the catalog and the schema that you mention. There is no XML catalog and no schema used for validating an XSLT stylesheet. The URI namespace for standard XPath functions is recognized internally by the validating XSLT engine without any schema or XML catalog set for the engine.


Regards,
Sorin
Post Reply