xslt transformation from within xst

Here should go questions about transforming XML with XSLT and FOP.
Patrik
Posts: 280
Joined: Thu Nov 28, 2013 9:32 am
Location: Hamburg/Germany
Contact:

xslt transformation from within xst

Post by Patrik »

Hi,

I extended the dita conref to an XsltConref which adds an xslt transformation to the referred content before displaying it. In the author view I implemented my own ReferenceResolver and it works fine.

Now I want to generate a pdf with fop from my document so I have to resolve the XsltConref within the xslt transformation. In details: I have an url to the xsl script and an xpath to the element. Now I know the saxon extension funtion saxon:evaluate to get the element, but how can I apply the transformation to it?

Thanks

Patrik
Radu
Posts: 9434
Joined: Fri Jul 09, 2004 5:18 pm

Re: xslt transformation from within xst

Post by Radu »

Hi Patrik,

The saxon:evaluate can only evaluate XPath expressions.
So I don't think you can do what you want with simple XSLT transformations.
Suggestions:

It might be possible to implement a Java extension function which you would call from the XSL code. That extension function would apply the secondary XSL and return a node set to the main XSL.

or:

Maybe you should add a pre-processing stage using some programming language like Java which parses over SAX the document and applies the stylesheet on each element to obtain an XML which has all these references expanded, then appply a final XSLT stage over this.

Or maybe XProc would be a candidate for this.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Patrik
Posts: 280
Joined: Thu Nov 28, 2013 9:32 am
Location: Hamburg/Germany
Contact:

Re: xslt transformation from within xst

Post by Patrik »

Hi Radu,

the idea with my own extension function for saxon I also already tried but failed to get it working. However, now I discovered the existing extension function saxon:transform which does just what I was looking for...

Thanks

Patrik
Radu
Posts: 9434
Joined: Fri Jul 09, 2004 5:18 pm

Re: xslt transformation from within xst

Post by Radu »

Hi Patrik,

Thanks for sharing this solution, I did not know about this extra Saxon 9 extension function, looks very handy for your exact purpose.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply