[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Question about xpath
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|