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

RE: Question about xpath

Subject: RE: Question about xpath
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Thu, 7 Oct 1999 17:32:52 +0100
xpath for each select
Try something like:

>    <xsl:for-each select="contract">
>         <xsl:variable name="current-contract" select="."/>
>         <xsl:for-each select="*[$view/column=name()]">
>             <xsl:value-of select="$current-contract"/>
>         </xsl:for-each>
>    </xsl:for-each>

(not tested.)
Mike Kay

> I want to edit a portfolio page with mulitple views.
> My views definition is stored in an xml file:
> 
> <view>
>     <name>my view</name>
>     <column>stock/name</column>
>     <column>quantity</column>
>     <column>price</column>
> </view>
> <view>
>     <name>another view</name>
>     .....
> </view>
> 
> where the "<columns>" define which column I want to select.
> and my portfolio xml looks like:
> 
> <portfolio>
>      <contract>
>         <stock>
>             <name>Red Pat</name>
>                ...
>         </stock>
>         <quantity>1000</quantity>
>         <price>20</price>
>     </contract>
>     <contract>
>         ....
>     </contract>
> </portfolio>
> 
> The question is : Can I use xsl to apply the views? If so, how?
> I have considered something like
> 
> <xsl:template match="portfolio">
>    <xsl:variable name="view"
> select="document('views.xml')/view[@name='my view']"/>
>    <xsl:for-each select="contract">
>          <xsl:variable name="current-contract" select="self::node()"/>
>         <xsl:for-each select="$view/column">
>             <xsl:value-of select="$current-contract/text()"/>
>         </xsl:for-each>
>    </xsl:for-each>
> </xsl:template>
> 
> and of course it doesn't work.:<
> 
> Thx a lot
> Daniel
> 
> 
>  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.