p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

xslt thread: Global Variable


Message #1 by kranthikumar thirunagari <crazykrans@y...> on Sat, 15 Jun 2002 01:03:06 -0700 (PDT)
Thanks alot Michael,
 am using XalanJ_2.3.1 version.
I have been testing alot on this,but interestingly i
found that when i pass the global variable "var1" as
parameter to the template T2 when i call it second
time from template T1, it works fine.Any implications
on this...?

Thanx,
krans.
--- Michael Kay <michael.h.kay@n...> wrote:
> That's a bug, please report it to Apache. Check
> first that you are using
> the latest Xalan version.
> 
> Michael Kay
> Software AG
> home: Michael.H.Kay@n...
> work: Michael.Kay@s... 
> 
> > -----Original Message-----
> > From: kranthikumar thirunagari
> [mailto:crazykrans@y...] 
> > Sent: 15 June 2002 09:03
> > To: P2P_XSLT
> > Subject: [xslt] Global Variable
> > 
> > 
> > I have a Global variable "var1" which i use it in
> a
> > template T2 for a condition check.
> > 
> > <xsl:variable name="var1">
> > 	<xsl:text>|c1|c2|</xsl:text>
> > </xsl:variable>
> > 
> > When another template T1 calls this template T2
> twice,
> > i get this exception.
> > 
> > javax.xml.transform.TransformerException: 7 >= 1
> > 	at org.apache.xpath.XPath.bool(XPath.java,
> Compiled
> > Code)
> > 	at
> >
>
org.apache.xalan.templates.ElemIf.execute(ElemIf.java:198)
> > 	at 
> >
>
org.apache.xalan.transformer.TransformerImpl.executeChildTempl
> > ates(TransformerImpl.java,
> > Compiled Code)
> > 	at
> >
>
org.apache.xalan.templates.ElemTemplate.execute(ElemTemplate.java:432)
> > 	at 
> >
>
org.apache.xalan.templates.ElemCallTemplate.execute(ElemCallTe
> > mplate.java,
> > Compiled Code)
> > 	at 
> >
>
org.apache.xalan.transformer.TransformerImpl.executeChildTempl
> > ates(TransformerImpl.java,
> > Compiled Code)
> > 	at 
> >
>
org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiter
> > alResult.java,
> > Compiled Code)
> > 	at 
> >
>
org.apache.xalan.templates.ElemForEach.transformSelectedNodes(
> > ElemForEach.java,
> > Compiled Code)
> > 	at
> >
>
org.apache.xalan.templates.ElemForEach.execute(ElemForEach.java:299)
> > 	at 
> >
>
org.apache.xalan.transformer.TransformerImpl.executeChildTempl
> > ates(TransformerImpl.java,
> > Compiled Code)
> > 	at
> >
>
org.apache.xalan.templates.ElemTemplate.execute(ElemTemplate.java:432)
> > 	at 
> >
>
org.apache.xalan.templates.ElemCallTemplate.execute(ElemCallTe
> > mplate.java,
> > Compiled Code)
> > 	at 
> >
>
org.apache.xalan.templates.ElemApplyTemplates.transformSelecte
> > dNodes(ElemApplyTemplates.java,
> > Compiled Code)
> > 	at
> >
>
org.apache.xalan.templates.ElemApplyTemplates.execute(ElemAppl
> > yTemplates.java:226)
> > 	at 
> >
>
org.apache.xalan.transformer.TransformerImpl.executeChildTempl
> > ates(TransformerImpl.java,
> > Compiled Code)
> > 	at
> >
>
org.apache.xalan.transformer.TransformerImpl.applyTemplateToNo
> > de(TransformerImpl.java:2069)
> > 	at 
> >
>
org.apache.xalan.transformer.TransformerImpl.transformNode(Tra
> > nsformerImpl.java,
> > Compiled Code)
> > 	at 
> >
>
org.apache.xalan.transformer.TransformerImpl.transform(Transfo
> > rmerImpl.java,
> > Compiled Code)
> > 	at
> >
>
org.apache.xalan.transformer.TransformerImpl.transform(Transfo
> > rmerImpl.java:1088)
> > 	at
> >
>
org.apache.xalan.transformer.TransformerImpl.transform(Transfo
> > rmerImpl.java:1066)
> > 	at
> >
>
IssueXMLTransformation.main(IssueXMLTransformation.java:32)
> > 
> > 
> > But when template T1 calls template T2 only once
> then
> > it works fine.
> > I guess the global variable is not reusable after
> one
> > time.
> > please let me know,why is this happening?
> > 
> > krans.
> > 
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! - Official partner of 2002 FIFA World Cup 
> http://fifaworldcup.yahoo.com
> 
> 
> 


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

  Return to Index