Re: [xsl] Linking Variable to the Path

Subject: Re: [xsl] Linking Variable to the Path
From: Matthieu Ricaud <matthieu.ricaud@xxxxxxxxx>
Date: Wed, 22 Aug 2007 16:32:46 +0200
Hi, 

When you told you were doing your transformation with Mozilla's XSLT-processor, I thought it was on client side, but your java code seams to be server side, is it ?
I don't know anything about JAXP but is there a relationship here with Mozilla's XSLT-processor ?

Anyway to know which xslt processor is used during the transformation, try to output this in your xsl :
<xsl:value-of select = "system-property('xsl:vendor')" />  

Regards,

Matthieu Ricaud

PS : the script proposed at http://www.xmleverywhere.com/tips/xslt.htm is only for msxml (that means IE5+)

> Hi Abel 
> Thank for the reply!
> 
> The following is the JAVA code which uses JAXP API for doing Transformation!
> 
> Is this API internally uses any XSLT processors? Because I am not mentioning
> anyone manually. 
>  
> javax.xml.transform.Source xmlSource =
> 			new
> javax.xml.transform.stream.StreamSource(xmlFile);
> javax.xml.transform.Source xsltSource =
> 			new
> javax.xml.transform.stream.StreamSource(xsltFile);
> javax.xml.transform.Result result =
> 			new javax.xml.transform.stream.StreamResult(file);
> 
> // create an instance of TransformerFactory
> javax.xml.transform.TransformerFactory transFact =
> 			javax.xml.transform.TransformerFactory.newInstance(
> );
> 
> javax.xml.transform.Transformer trans =
> 			transFact.newTransformer(xsltSource);
> 
> trans.transform(xmlSource, result);
> 
> 
> Conversations are included from the start!!
> Please refer my original mail for actual problem!
> 
> I hope somebody will be able to help!
> 
> Thanks a lot.
> 
> Regards
> Yaswanth Ravella
> 
> -----Original Message-----
> From: Abel Braaksma [mailto:abel.online@xxxxxxxxx] 
> Sent: Wednesday, August 22, 2007 6:37 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: [xsl] Linking Variable to the Path
> 
> what is the connection with your earlier inquiry? You are asking whether 
> JAXP works with JAXP, while failing to understand why you ask, the 
> answer is a definite YES.
> 
> but JAXP has nothing to do with TransformIIX (you use Firefox and that 
> is the name of the XSLT processor) and has next to nothing to do with 
> XSLT in general (not directly, at least).
> 
> Cheers,
> -- Abel Braaksma
> 
> Yaswanth Kumar Ravella wrote:
> > Hi How about?
> > Java API for XML Processing (JAXP)
> > Will this work fine with JAXP?
> >
> > Cheers
> > Yaswanth Ravella
> >
> >
> >
> > -----Original Message-----
> > From: christoph.naber@xxxxxxxxxxxxxxxxxxx
> > [mailto:christoph.naber@xxxxxxxxxxxxxxxxxxx] 
> > Sent: Wednesday, August 22, 2007 5:18 PM
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject: RE: [xsl] Linking Variable to the Path
> >
> >   
> >> I am getting Error :
> >> Description :
> >> Error during XSLT transformation: An unknown XPath extension function 
> >>     
> > was
> >   
> >> called.
> >>
> >> I am using Mozilla's Processor !
> 
> Hi Yaswanth, 
> 
> > Hi Peter and Everyone out there!
> >   Thanks for the reply ~
> > 
> > I have '//every[1]/event[1]' as the destination attributes value.
> > And there is 'name' attribute  for '//every[1]/event[1]'
> > i.e //every[1]/event[1]/@name gives me the Value 'Ready'.
> > 
> > Why not $dest/@name gives me the same ?
> > How to get it  ?
> 
> In your fisrt xsl <xsl:variable name="dest"
> select="//every[1]/event[1]"/>  will get a *node* /root/every[1]/event[1], 
> which do has a @name attribute. Then $dest/@name will get this attribute
> value.
> 
> But in your second xsl  <xsl:variable name="dest"
> select="//pattern[1]/connection[1]/@destination"/>   will get the *string*
> "//every[1]/event[1]"
> which is the value of @destination. $dest is not a node, it's a string and
> you can't do $dest/@name, it doesn't make sens.
> 
> As said Christoph you need to evaluate the string, and there is
> unfortunately no xslt 1.0 native way to do this !
> You need a extension eval function depending on your xslt processor. 
> If you use saxon for example, something like this should go <xsl:value-of
> select="saxon:eval($dest)/@name"/>.
> With msxml you can do your own eval function in jscript, have a look at
> http://www.xmleverywhere.com/tips/xslt.htm
> You can also use EXSLT extensions I think.
> 
> Hope this help, 
> 
> Cheers, 
> 
> Matthieu.
>  
> > Regards
> > Yaswanth
> > 
> > 
> > -----Original Message-----
> > From: Hofman, Peter [mailto:peter.hofman@xxxxxxxxxxxxx]
> > Sent: Wednesday, August 22, 2007 1:54 PM
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject: RE: [xsl] Linking Variable to the Path
> > 
> > Your variable $dest contains a sequence of destination attributes 
> > values, which (of course) do not contain a name attribute.
> > 
> > You need to analyze the contents of connection/@destination and use 
> > this in a selection of event elements.
> > 
> > Regards,
> > Peter
> > 
> > >-----Original Message-----
> > >From: Yaswanth Kumar Ravella [mailto:yaswanth.mtrx@xxxxxxxxx]
> > >Sent: woensdag 22 augustus 2007 10:16
> > >To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > >Subject: [xsl] Linking Variable to the Path
> > >
> > >
> > >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.

Current Thread