[xsl] stylesheet params and parsing a (MathML) string

Subject: [xsl] stylesheet params and parsing a (MathML) string
From: Manolis Mavrikis <M.Mavrikis@xxxxxxxx>
Date: Sun, 23 Nov 2003 22:05:40 +0000
Hi ... I have a couple of questions (apologies for the extension content but I figured out others are using node-set a lot so thought of posting here)

1)The easy one first:


I am sending a parameter to a stylesheet with


<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>

I am using the node-set extension to apply templates on it

<xsl:apply-templates select="exsl:node-set($variables-tree)/*">

which is then matched

<xsl:template match="myTree">	
   ... do stuff ...
</xsl:template>

Ok.. This worked for me before (thanks to the article in http://www.xml.com/pub/a/2003/07/16/nodeset.html) but this time I had problems. I figured out that it has to do with namespaces that these are happening into (eg. the apply-templates is happening into a <m:mn> element) so the template is not matched.

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 doesn't look a really neat way to do things. Is this the correct way or am I doing something wrong ?


2) Ok now the other part:


Apart from sending values lets say that I want to send a parameter with MathML (or any XML for that matter) in it. Is there a way to "parse" it (assuming its valid etc) and include it in my tree as before. I was hoping that

<xsl:copy-of select="exsl:node-set($param2)"/>

would work but it obviously can't. I could start creating other files and piping things around but this solution would be neater. I saw some similiar messages about parsing a couple of years ago but I can't find something towards that direction.

Thanks for all your help.

Manolis







XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


Current Thread