Project

Profile

Help

specify initial context node?

Added by Anonymous over 19 years ago

Legacy ID: #3230788 Legacy Poster: Jan Van den Bussche (vdbuss)

Hello, Using saxon, to initiate a transformation, you can set an initial template, you can set an initial mode, but can you also set an initial context node, as prescribed in the XSLT 2.0 specs? Best, Jan


Replies (4)

Please register to reply

RE: specify initial context node? - Added by Anonymous over 19 years ago

Legacy ID: #3230795 Legacy Poster: Jan Van den Bussche (vdbuss)

...allow me immediately to follow up on myself: I just tried the -im option to specify the name of an initial template, but that doesn't work like that---apparently something else is meant with that option. I now even see in the doc that you are not supposed to give a stylesheet if you use the -im option, and indeed that is what saxon complains about, because I still gave a stylesheet. I don't understand this at all. Best, Jan

RE: specify initial context node? - Added by Anonymous over 19 years ago

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

When calling from the command line: -it sets the initial template -im sets the initial mode The initial context node is the root node of the source document specified on the command line. When calling using the JAXP interface, you can supply a Saxon node (class NodeInfo) as the first argument to the Transformer#transform() method, and that node will be the initial context node. Michael Kay

RE: specify initial context node? - Added by Anonymous over 19 years ago

Legacy ID: #3231480 Legacy Poster: Jan Van den Bussche (vdbuss)

Thanks for your response Michael, prompt as ever! I knew it was -it for initial template, sorry for the typo. But as I mentioned that does not work in the way I would expect it. Allow me to give a concrete example: <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:template name="mystart"> <yep/> </xsl:template> </xsl:transform> I put the above stylesheet in a file initial.xls and give the command: java net.sf.saxon.Transform -it mystart t.xml initial.xsl and I get the following error: Bad param=value pair on command line: initial.xsl This is consistent with what you write in the documentation for the -it option (but what I do not understand), namely that if one uses -it then one cannot specify a stylesheet file??? Best, Jan

RE: specify initial context node? - Added by Anonymous over 19 years ago

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

If you specify -it on the command line, then you cannot specify a source document. You still specify a stylesheet. If there is somewhere that the documentation says the stylesheet argument should be omitted, then I would be grateful if you could point me to the place where the error occurs. The specification allows both an initial template and an initial context node to be supplied, and Saxon supports this from the Java API, but not from the command line. Michael Kay

    (1-4/4)

    Please register to reply