Subject: Re: [xsl] stylesheet params and parsing a (MathML) string From: David Carlisle <davidc@xxxxxxxxx> Date: Mon, 24 Nov 2003 00:04:28 GMT |
> After a while I came to the (not-so-suprising) conclusion that this >created element is in the xhtml namespace (which is the default of my > stylesheet) hence matching: match="xhtml:myTree" works. This means that > I have to declare this as well as a namespace in the stylesheet. This XSLT doesn't care but you probably shouldn't be putting your own elements into the xhtml namespace, you can explicitly put them in some other namespace using the namespace attribute of xsl:element 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 <xsl:variable name="tree"> <xsl:element name="myTree"> <xsl:attribute name="id"> <xsl:value-of select="$param1"/></xsl:attribute> </xsl:attribute> <xsl:value-of select="$param2"/> </xsl:element> </xsl:variable> do <xsl:variable name="tree" xmlns=""> <myTree id="{$param1}"> <xsl:value-of select="$param2"/> </myTree> </xsl:variable> > I was hoping that > > <xsl:copy-of select="exsl:node-set($param2)"/> > > would work but it obviously can't. 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. 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. David -- http://www.dcarlisle.demon.co.uk/matthew XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] stylesheet params and parsing, Manolis Mavrikis | Thread | Re: [xsl] stylesheet params and par, Manolis Mavrikis |
Re: [xsl] multi-document question, Bruce D'Arcus | Date | Re: [xsl] multi-document question, David Carlisle |
Month |