Subject: Re: [xsl] Linking Variable to the Path From: mozer <xmlizer@xxxxxxxxx> Date: Mon, 27 Aug 2007 01:14:15 +0200 |
Another way to solve your problem is by generating an ad hoc XSLT == This stylesheet generate another stylesheet == <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:axsl="http://www.w3.org/1999/XSL/TransformAlias"> <xsl:output method="xml"/> <xsl:namespace-alias stylesheet-prefix="axsl" result-prefix="xsl"/> <xsl:template match="/"> <axsl:stylesheet version="1.0"> <axsl:template match="/"> <axsl:variable name="dest" select="{//every[1]/event[1]}"/> <axsl:value-of select="$dest/@name"/> </axsl:template> </axsl:stylesheet> </xsl:template> </xsl:stylesheet> == The resulting stylesheet is to apply to your document Xmlizer On 8/22/07, Yaswanth Kumar Ravella <yaswanth.mtrx@xxxxxxxxx> wrote: > > Hi, > > ::I am having an XML file like this :: > > <root> > <every> > <event name="Ready"/> > </every> > <pattern> > <connection destination="//every[1]/event[1]" /> > </pattern> > </root> > ------------------------------- > ::When my XSL file has this code:: > > <xsl:template match="root"> > <xsl:variable name="dest" select="//every[1]/event[1]"/> > <xsl:value-of select="$dest/@name"/> > </xsl:template> > > It prints 'Ready'. > Here I am directly assigning variable 'dest' to the path of the event. > This is ok. > ------------------------------- > ::When I changed my XSL code to :: > > <xsl:template match="root"> > <xsl:variable name="dest" > select="//pattern[1]/connection[1]/@destination"/> > <xsl:value-of select="$dest/@name"/> > </xsl:template> > > It doesn't print 'Ready' or anything. > Here I am storing variable 'dest' with the value of the > 'connection/@destination', Which I expected to work properly but it is not > working. > ------------------------------ > > How can I print 'event-name' using 'connection-destination'? > > > Regards > Yaswanth Ravella
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Linking Variable to the P, Michael Kay | Thread | RE: [xsl] Linking Variable to the P, Hofman, Peter |
Re: [xsl] Open Document Format, Kamal Bhatt | Date | Re: [xsl] Newbie Q - transformation, John Smith |
Month |