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

RE: xsl:with ?

Subject: RE: xsl:with ?
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Sat, 9 Mar 2002 15:05:15 -0000
variable in document javascript
It would seem that your proposed

   <xsl:with select="xxx">

is a synonym for

   <xsl:for-each select="xxx[1]">

If we are out to save keystrokes I can thnk of plenty of changes that would
give a better return than this one...

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Jeff Beadle
> Sent: 08 March 2002 16:46
> To: xsl-list
> Subject:  xsl:with ?
>
>
> Hello all,
>
> I apologize up front for not being upto speed on what going
> on with xstl
> 2.0,
> but I have a question for those who have:
>
> Will there be anything like a "with" statement?
>
> For example, in javascript I can do this:
>
>    var x = new ActiveXObject("MSXML2.DOMDocument.3.0");
>
>    with(x)
>    {
>       async = false;
>
>       validateOnParse = false;
>
>       if( ! loadXML(...) ) {
>          ...
>       }
>       ...
>    }
>
>
> I make common use of this pattern within xslt, but I have to
> use a for-each.
>
> For example:
>
>    <xsl:variable name="BaseElementInstance">
>       <BaseElement someAttribute="This is someAttribute"
>                someOtherAttribute="This is someOtherAttribute">
>          <ChildElement>blah blah</ChildElement>
>       </BaseElement>
>    </xsl:variable>
>
>    <xsl:for-each
> select="msxsl:node-set($BaseElementInstance)/BaseElement">
>       <DerivedElement>
>          <xsl:copy-of
> select="attribute::*[not(@someOtherAttribute)]"/>
>          <xsl:attribute name="someOtherAttribute">
>             Derived attribute 'someOtherAttribute' was overridden by
> DerivedElement.
>         </xsl:attribute>
>        <xsl:copy-of select="descendant::*"/>
>        <DerivedElmentsChildElement/>
>       </DerivedElement>
>    </xsl:for-each>
>
>
> So after too much detail (sorry), here's what I'd like to do:
>
>    Replace my xsl:for-each with an xsl:with.
>
> For example:
>
>    <xsl:variable name="stuff">
>       ...
>    </xsl:variable>
>
>    <xsl:with select="msxsl:node-set($stuff)/BaseElement">
>       ...
>    </xsl:with>
>
>
> The xsl:with implementation of 'select' would--in fact--be like:
>
>    select="msxsl:node-set($BaseElementInstance)/BaseElement[1]"
>
> If the pattern query succeeds, it always uses the context of
> the first node
> in
> the resultant nodeset.
>
>
> Anyhow, perhaps I'm just being lazy.
>
> Thanks,
> Jeff
>
>
>
>
>
>  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
  • xsl:with ?
    • Jeff Beadle - Fri, 8 Mar 2002 11:42:50 -0500 (EST)
      • Peter Davis - Fri, 8 Mar 2002 16:04:27 -0500 (EST)
      • Michael Kay - Sat, 9 Mar 2002 10:01:18 -0500 (EST) <=

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.