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

RE: A very interesting feature of MSXML

Subject: RE: A very interesting feature of MSXML
From: "Oleg Tkachenko" <olegt@xxxxxxxxxxxxx>
Date: Sat, 11 Aug 2001 18:37:51 +0200
xslt mode attribute msxml
Hello Alexander !

I think that is a good example of how extension functions can break up xslt's free of side-effects nature.

---
Oleg Tkachenko,
Multiconn International 

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of 
> Alexander Gutman
> Sent: Saturday, August 11, 2001 2:58 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  A very interesting feature of MSXML
> 
> 
> Hello, friends.
> 
> I have just discovered a very interesting feature of MSXML.
> If we transform this:
> 
>   <root>
>     <one/>
>     <two/>
>     <three/>
>   </root>
> 
> via this:
> 
>   <xsl:transform version="1.0"
>     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>     xmlns:msxsl="urn:schemas-microsoft-com:xslt"
>     xmlns:x="urn:x">
> 
>     <msxsl:script language="JScript" implements-prefix="x">
>       var m = 'old';
>       function setMode(newMode){ m = newMode; return 'changed' }
>       function mode(){ return m }
>     </msxsl:script>
> 
>     <xsl:template match="/root" priority="1">
>       <result>
>         <xsl:apply-templates select="*"/>
>       </result>
>     </xsl:template>
> 
>     <xsl:template match="*[x:mode()='old']">
>       <xsl:copy>
>         <xsl:attribute name="mode">old</xsl:attribute>
>       </xsl:copy>
>     </xsl:template>
> 
>     <xsl:template match="*[x:mode()='new']">
>       <xsl:copy>
>         <xsl:attribute name="mode">new</xsl:attribute>
>       </xsl:copy>
>     </xsl:template>
> 
>     <xsl:template match="two" priority="1">
>       <two mode="{x:setMode('new')}"/>
>     </xsl:template>
> 
>   </xsl:transform>
> 
> then we obtain:
> 
>   <result>
>     <one mode="old"/>
>     <two mode="changed"/>
>     <three mode="new"/>
>   </result>
> 
> I did not believe it would work, but it works!
> I am not sure that this behavior is standards-driven,
> but it is very convenient.
> 
> -- 
> Alexander E. Gutman
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 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.