transform fails in eXist, works from command line, exslt:node-set problem?

View: New views
1 Messages — Rating Filter:   Alert me  

transform fails in eXist, works from command line, exslt:node-set problem?

by bkc :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm not sure if this is worth reporting, I have a workaround, but  maybe
it's important to someone else down the road.

In a collection I have these files

        metal.xsl                          12288  Jul 16 15:53
        metal_and_tal.xsl                   4096  Jul 16 15:53
        tal2xslt.xsl                       36864  Jul 16 15:53


When I transform a source file using metal_and_tal.xsl, I'll get back a
.xsl file which I can then use to generate html by transforming some
other xml source.

metal_and_tal.xsl uses exslt:node-set and xsl:import to combine two
separate processing steps together in one transform.

 From the command-line using xalan, this works fine:

 >> java -cp
lib/endorsed/xalan-2.7.1.jar:lib/endorsed/xml-apis.jar:lib/endorsed/xercesImpl-2.9.1.jar:lib/endorsed/serializer-2.9.1.jar
org.apache.xalan.xslt.Process -IN /tmp/master.htm -XSL
~/src/bazaar/ATALi/tal2xslt/tal2xslt/xsl/metal_and_tal.xsl -PARAM
tal_global_variables "url_prefix ''"

The command line produces the expected output.

When the same transform is run within eXist, I get a weird error:

An exception occurred during query execution: A SAX exception occurred
while compiling the stylesheet: ElemTemplateElement error: process_tal
[at line 12, column 8] [at line 12, column 8]

(process_tal is defined in tal2xslt.xsl)

This is the failing xquery:

xquery version "1.0";

declare namespace xmldb="http://exist-db.org/xquery/xmldb";
declare namespace util="http://exist-db.org/xquery/util";
declare namespace transform="http://exist-db.org/xquery/transform";

let $tal2xslt_dir_path := '/db/ATALi/tal2xslt/tal2xslt/xsl',
    $metal_and_tal_stylesheet := doc(concat($tal2xslt_dir_path,
'/metal_and_tal.xsl'))

let $source_file := doc('master.htm')
let $parameters := <parameters><param name="tal_global_variables"
value="url_prefix ''"/></parameters>
return transform:transform($source_file, $metal_and_tal_stylesheet,
$parameters)


If I split up the transform into two steps in xquery, it works:

xquery version "1.0";

declare namespace xmldb="http://exist-db.org/xquery/xmldb";
declare namespace util="http://exist-db.org/xquery/util";
declare namespace transform="http://exist-db.org/xquery/transform";

let $tal2xslt_dir_path := '/db/ATALi/tal2xslt/tal2xslt/xsl',
    $metal_stylesheet := doc(concat($tal2xslt_dir_path, '/metal.xsl')),
    $tal2xslt_stylesheet := doc(concat($tal2xslt_dir_path, '/tal2xslt.xsl'))

let $source_file := doc('master.htm')
let $parameters := <parameters><param name="tal_global_variables"
value="url_prefix ''"/></parameters>
return transform:transform(
      transform:transform($source_file,
          $metal_stylesheet,
          $parameters
      ),
      $tal2xslt_stylesheet,
      $parameters)


Finally, here's metal_and_tal.xsl:

<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:exslt="http://exslt.org/common" xmlns:const="const.uri"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:bxf="http://bitflux.org/functions"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:func="http://exslt.org/functions" xmlns:xsl_="whatever"
version="1.0" extension-element-prefixes="func exslt"
exclude-result-prefixes="bxf xhtml">
    <xsl:import href="metal.xsl"/>
    <xsl:import href="tal2xslt.xsl"/>
    <xsl:namespace-alias stylesheet-prefix="xsl_" result-prefix="xsl"/>
    <xsl:template match="/">
        <xsl:variable name="metal_output">
            <xsl:apply-templates mode="metal"/>
        </xsl:variable>
        <xsl:for-each select="exslt:node-set($metal_output)">
            <xsl:call-template name="process_tal"/>
        </xsl:for-each>
    </xsl:template>
</xsl:stylesheet>

I have no idea why this works from the command line but fails from
within eXist.

Anyway I'll keep going using my two-step transform.



--
Brad Clements,                bkc@...    (315)268-1000
http://www.murkworks.com                         
AOL-IM: BKClements


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open
LightInTheBox - Buy quality products at wholesale price