Page 1 of 1

xslt transformation from within xst

Posted: Thu Nov 28, 2013 11:48 am
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

Re: xslt transformation from within xst

Posted: Thu Nov 28, 2013 12:24 pm
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

Re: xslt transformation from within xst

Posted: Thu Nov 28, 2013 3:26 pm
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

Re: xslt transformation from within xst

Posted: Thu Nov 28, 2013 3:33 pm
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