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

Re: Can I change variable contents.

Subject: Re: Can I change variable contents.
From: Mukul Gandhi <mukulgandhi2003@xxxxxxxxxxx>
Date: Thu, 8 Apr 2004 15:59:25 +0100 (BST)
xsl change variable
Hi Vikram,
  Please try the XSL -

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" version="1.0"
encoding="UTF-8" indent="yes"/>
	
<xsl:key name="x" match="/root/Tag"
use="substring-before(@value, ':')" />
	
<xsl:template match="/root">
   <xsl:for-each select="Tag">
       <xsl:if test="generate-id(.) =
generate-id(key('x', substring-before(@value,
':'))[1])">
            <xsl:for-each select="key('x',
substring-before(@value, ':'))">
              <xsl:value-of
select="substring-after(@value, ':')" /><xsl:text>
</xsl:text>
            </xsl:for-each> from <xsl:value-of
select="substring-before(./@value, ':')" />
       </xsl:if>
   </xsl:for-each>
</xsl:template>
	
</xsl:stylesheet>

It uses Muenchian method for grouping as suggested by
David Carlisle. 

Regards,
Mukul

 --- Vikram Barate <vikram@xxxxxxxxxx> wrote: > I'm
trying to explain my problem in following
> example.
> I've following kind of xml
> 
> <Tag value="grade:1">
>     .....
> </Tag>
> <Tag value="sub:B">
> ....
> </Tag>
> <Tag value="grade:2">
>     .....
> </Tag>
> <Tag value="grade:3">
> ...
> </Tag>
> <Tag value="sub:A">
> ...
> </Tag>
> 
> and I want to generate output in text format as
> follows:
> 
> 1 2 3 from grade
> A B from sub
> 
> values attribute of Tag1 node can contain anything
> in fomat "X:Y", and 
> I've to print all values of the Ys for all the Xs in
> above shown format.
> I tried appling some logics but I could not achieve
> this yet. Can anyone 
> suggest me simple logic in xsl to achieve this.
> 
> One general Question: If we can't change
> xsl:variable, then why it is 
> named variable? is should be xsl:constant.
> 
> Thanx,
> Vikram.
> 
> cknell@xxxxxxxxxx wrote:
> 
> >> -----Original Message-----
> >> From:     Vikram Barate <vikram@xxxxxxxxxx>
> >>
> >>
> >> Can I change value of variable declared using
> <xsl:variable> tag.
> >
> >
> > No
> >
> >> If no then is there any other way i can create
> VARIABLES and update 
> >> those.
> >
> >
> > No
> >
> > As has been said here before many times, tell us
> what you need to 
> > accomplish, not how you wish to accomplish it, and
> we can help.
>  

________________________________________________________________________
Yahoo! India Matrimony: Find your partner online. http://yahoo.shaadi.com/india-matrimony/

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.