XSLT: How do I trigger a template when there is no input file?
Posted
by Ben Blank
on Stack Overflow
See other posts from Stack Overflow
or by Ben Blank
Published on 2009-08-03T19:35:25Z
Indexed on
2010/04/20
0:03 UTC
Read the original article
Hit count: 310
I'm creating a template which produces output based on a single string, passed via parameter, and does not use an input XML document. xsltproc
seems to happily run with a single parameter specifying the stylesheet, but I don't see a way to trigger a template without an input file (no parameter to xsltproc
to run a named template, for example).
I'd like to be able to run:
xsltproc --stringparam bar baz foo.xsl
But I'm currently having to run, with the "main" template matching "/":
echo '<xml/>' | xsltproc --stringparam bar baz foo.xsl -
How can I get this to work? I'm sure I've seen other templates in the past which were meant to be run without an input document, but I don't remember how they worked or where to find them again. :-)
© Stack Overflow or respective owner