Quantcast

Re: how to pass node as param fortransform:transform ()?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to pass node as param fortransform:transform ()?

Adam Retter-7
The data I want to display from the XSLT is not in a document it is
produced from an XQuery.

Also, Saxon seems to support passing nodes as parameters using something
like this -

<param name="categories>
        <categories>
                <category>cat test 1</category>
                <category>cat test 2</category>
        </categories>
</param>

I tried this in eXist but it complained about missing attribute "value",
how can I acheive this in eXist? Or does eXist even allow this, if not
how could I implement it in the Java code (i.e. where do i start
looking)?

Thanks Adam.




On Tue, 2005-09-13 at 10:29 +0100, Michael Beddow wrote:

> Adam,
>
> >  <param name="categories" value="<categories><category> [etc.etc.]"
>
> You are trying to put markup into an attribute value. No can do. Try
> passing
> the name of a document and then read it into the xslt via
> xsl:document()
>
> Michael Beddow
>
>
>
>
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle
> Practices
> Agile & Plan-Driven Development * Managing Projects & Teams * Testing
> & QA
> Security * Process Improvement & Measurement *
> http://www.sqe.com/bsce5sf 
> _______________________________________________
> Exist-open mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/exist-open
>


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to pass node as param fortransform:transform()?

Michael Beddow-2
> The data I want to display from the XSLT is not in a document it is
> produced from an XQuery.

Then you can write the query result into the database on the fly and
reference the nodes it contains via xsl:document(). If I understand rightly,
such an on-the-fly document will be cached in memory, so there shouldn't be
much of a performance penalty.

> Also, Saxon seems to support passing nodes as parameters using something
> like this -
>
> <param name="categories>
> <categories>
> <category>cat test 1</category>
> <category>cat test 2</category>
> </categories>
> </param>
>

Well yes, that's standard XSLT syntax. Put it into an xslt sheet you ask
eXist to process and it won't complain (or at least I hope it won't). But
the code you are writing isn't XSLT, it's eXist's method of *invoking* XSLT.
I imagine the invocation mechanism could be changed, but while it remains in
the form of an attribute value there's no way you are going to get markup in
such a position past the parser.

Michael Beddow



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to pass node as param fortransform:transform ()?

wolfgangmm
In reply to this post by Adam Retter-7
Hi Adam,

> The data I want to display from the XSLT is not in a document it is
> produced from an XQuery.

Why don't you pass the node fragment as part of the document to
transform? That's how I do it. Just put a wrapper node around the
fragment you want to transform, add your categories as first child,
the document root as second:

let $t :=
  <root>
    <categories>...</categories>
    { doc("/db/CommunityDirectory/data/1.xml") }
  </root>
return transform:transform($t, ...)

eXist uses lazy evaluation here, so you should not see a performance loss.

> how could I implement it in the Java code (i.e. where do i start
> looking)?

It certainly is possible somehow, but I don't know if it is worth the
effort. The whole processing happens in
org.exist.xquery.functions.transform.Transform.

Wolfgang


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Loading...