Re: Question about xpath

Subject: Re: Question about xpath
From: Zvi Avraham <zvia@xxxxxxxxxxxxxxx>
Date: Mon, 11 Oct 1999 18:48:01 +0200

Lung wrote:

> Hi all
>
> 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']"/>

try name instead of @name ...
it's element not attribute

>
>    <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

--
-------------------------------------------------
Zvi Avraham, Senior Software Engineer
NetManage Inc., Visual Connectivity Division
http://www.netmanage.com/products/visual_conn.asp

begin:vcard 
n:Avraham;Zvi
tel;cell:+972-52-837908
tel;fax:+972-3-5788752
tel;home:+972-4-8551158
tel;work:+972-3-5788753
x-mozilla-html:FALSE
url:http://www2.netmanage.co.il/~zvia
org:NetManage, Inc.;Visual Connectivity Division<BR><A HREF="http://www.netmanage.com";><IMG SRC="http://www.netmanage.com/images/newhead-l.gif"; WIDTH="129" HEIGHT="63" ALT="NetManage" BORDER="0"></A><A HREF='http://www.netmanage.com/products/visual_conn.asp'><IMG SRC='http://www.netmanage.com/images/vc_middle.gif' WIDTH=227 HEIGHT=63 ALT='NetManage Visual Connectivity Group' border=0></A>
adr:;;;;;;
version:2.1
email;internet:zvia@xxxxxxxxxxxxxxx
title:Senior Software Engineer
note:I beleive I can fly !
fn:Zvi Avraham
end:vcard
Current Thread