David wrote:
but then you'd have to declare that namespace again to match on the
elemens so simpler is probably to put them all in no-namespace
xsl:element isn't needed if your element names are known in advance so
I'd use literal result elements and locally switch the default namespace so
instead of
[...]
do
<xsl:variable name="tree" xmlns="">
<myTree id="{$param1}">
<xsl:value-of select="$param2"/>
</myTree>
</xsl:variable>
My elements are know in advance but for attribute values I was really
using a function and I never thought of using:
<myTree id="substring-before($params,'|')">
which now works.
David, Thanks (once again) for your prompt,accurate and extremely useful reply
I still don't get it though. Out of curiosity shouldn't elements
created with <xsl:element> be in the namespace of their conttainer ?
---
For the other part:
If $param2 is a string thaen as you say you'll need a parser.
some systems (eg saxon) provide extension functions to parse a string
(and in msxml you could easily write an jscript extension function to do
this) alternatively (and better in many cases) is to pass a node set
representing a parsed document in as the parameter then you can apply
templates directly to it and dont need nodeset() at all.
that seems a better solution ...
Yousualy you can't do this from a command line call but can do it if you
are calling xslt from any kind of script or API.
the stylesheet **will be called from a java.xml tranformer and xalan
will process it. I 'll try do it later and I hoping that xalan will
understand the node parameter... meanwhile if anyone has any advice (eg.
what java object should I send?) it would be very useful.
Thanks again,
Manolis
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list