[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: stylesheet params and parsing a (MathML) string

Subject: Re: stylesheet params and parsing a (MathML) string
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 24 Nov 2003 00:04:28 GMT
mathml to string


> 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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.