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

xsl:with ?

Subject: xsl:with ?
From: Jeff Beadle <Jbeadle@xxxxxxxx>
Date: Fri, 8 Mar 2002 11:46:08 -0500
derived attribute and xml
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


Current Thread
  • xsl:with ?
    • Jeff Beadle - Fri, 8 Mar 2002 11:42:50 -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.