Question about xpath

Subject: Question about xpath
From: Lung <lung@xxxxxxxxxx>
Date: Thu, 07 Oct 1999 22:34:38 +0800
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']"/>
   <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


Current Thread