Project

Profile

Help

saxon:serialize in xslt

Added by Anonymous almost 18 years ago

Legacy ID: #3785355 Legacy Poster: Henry Story (bblfish)

I have just transformed my xquery transform to xslt using xq2xsl [1]. It transforms the saxon:serialize call to this: <xsl:function name="loc:serialize" as="xs:string"> <xsl:param name="el" as="element()"/> <xsl:for-each select="$input"> <xsl:sequence select="replace(saxon:serialize($el),'^[^&amp;gt;]*&gt;','')"/> </xsl:for-each> </xsl:function> The saxon:serialize documentation [2] says that "When called within an XSLT stylesheet, the second argument is the name of an xsl:output element in the stylesheet" But as I understand xsl:output elements get merged together, and I needed my main xsl:output element to output text. How is this meant to work? [1] http://monet.nag.co.uk/xq2xml/ [2] http://www.saxonica.com/documentation/extensions/functions/serialize.html


Replies (5)

Please register to reply

RE: saxon:serialize in xslt - Added by Anonymous almost 18 years ago

Legacy ID: #3785360 Legacy Poster: Henry Story (bblfish)

Euh slight mistake the code generated contains: saxon:serialize($el,'xml')

RE: saxon:serialize in xslt - Added by Anonymous almost 18 years ago

Legacy ID: #3785385 Legacy Poster: Michael Kay (mhkay)

In XSLT 2.0, xsl:output elements can be named (with a name attribute). They are only merged if they have the same name. The main output file uses the unnamed xsl:output declarations, but secondary output files (xsl:result-document) can use named declarations.

RE: saxon:serialize in xslt - Added by Anonymous almost 18 years ago

Legacy ID: #3785868 Legacy Poster: Henry Story (bblfish)

Thanks. Still I am having difficulty. The xslt created by the xq2xsl tool must have some bug. It seems to only generate text output from the xml but not any of the text . But the general format of what is output tend to make me think that it is mostly correct. Perhaps you can see an evident bug in the transform. I have tried quite a lot of things, but can't get it to work just like that. If there is no obvious saxon dependency problem, I'll post a message to the xq2xsl mailing list. If that tool worked it would be really great. https://sommer.dev.java.net/atom/2006-06-06/transform/a2t.xsl

RE: saxon:serialize in xslt - Added by Anonymous almost 18 years ago

Legacy ID: #3786497 Legacy Poster: Michael Kay (mhkay)

I'm afraid that since there's no evidence here of any Saxon problem, I'm not going to be able to spend any time helping you with this.

RE: saxon:serialize in xslt - Added by Anonymous almost 18 years ago

Legacy ID: #3793163 Legacy Poster: Henry Story (bblfish)

David Carlisle helped me out with this. I was meant to call the generated xslt like this saxon8 -o ongoing.t2 -it main atom2turtle.xsl +input=ongoing.atom After a few small extra changes I am able to get it to work using the W3C xslt service. See https://sommer.dev.java.net/atom/

    (1-5/5)

    Please register to reply