Subject: RE: [xsl] xsl:with ? From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx> Date: Sat, 9 Mar 2002 15:05:15 -0000 |
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] 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] xsl:with ?, Peter Davis | Thread | [xsl] Using HTTP request parameters, James Andersen |
RE: [xsl] How can i convert the var, Michael Kay | Date | RE: [xsl] variable in document XPat, Michael Kay |
Month |