Menu

#87 XSLT pipeline : Error XPDY0002 - The context item for axis step fn:root(...)/element() is absent

v1.0_(example)
open
nobody
None
1
2019-04-03
2019-01-24
No

Hi @mhkay,

I need some help dealing with saxon api :)
I create a pipeline with 2 XsltTransform of the same xslt and when i run transform i get this error :


2019-01-24 11:32:15,673 [pool-2-thread-1] INFO e.s.e.x.XsltListener - file
2019-01-24 11:32:15,674 [pool-2-thread-1] INFO e.s.e.x.XsltListener - Error XPDY0002 while evaluating xsl:message content: The context item for axis step fn:root(...)/element() is absent


here is my xslt :


<xsl:stylesheet exclude-result-prefixes="#all" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:variable name="supp" as="xs:string" select="root()/*/name()"/>

<xsl:template match="/">
    <xsl:message select="$supp"/>
    <file/>
</xsl:template>


the first XsltTransform work fine but It seems that i have no context node during the second XstTransform running.

I use :
transformer1.setSource(source) : source is a SAXSource
transformer1.setDestination(transformr2)
transformr2.setDestination(serialiser)

According to documentation (XsltTransform.setInitialContextNode):
This value is ignored in the case where the XsltTransformer is used as the Destination of another process. In that case the initial context node will always be the document node of the document that is being streamed to this destination.

Thanks for your Help

</xsl:stylesheet>

Discussion

  • Michael Kay

    Michael Kay - 2019-01-24

    Sorry, but we don't use SourceForge for issue tracking. Please raise this again at http://saxonica.plan.io -- or if you prefer, on StackOverflow with a "saxon" tag.

     
  • Anonymous

    Anonymous - 2019-04-03
    Post awaiting moderation.
  • Anonymous

    Anonymous - 2019-04-03
    Post awaiting moderation.
  • Anonymous

    Anonymous - 2019-04-03
    Post awaiting moderation.

Anonymous
Anonymous

Add attachments
Cancel