RE: [xsl] NEED good information on alternative for dyn:evaluate() for MSXML

Subject: RE: [xsl] NEED good information on alternative for dyn:evaluate() for MSXML
From: Pieter Reint Siegers Kort <pieter.siegers@xxxxxxxxxxx>
Date: Thu, 27 May 2004 16:40:03 -0500
Steve,
> So, instead of hard coding the param into the select it needs to variable.

If I understand your question, then you'd simply want to pass the
dynamically generated XPath to the XSL processor as a parameter, like here
(it's a Javascript function I used in an ASP 3.0 page):

<%
...
...
function transformDataS(srcDoc,xslProc,IdCd,Fecha,Hora) 
{
  // point to the compiled processor
  xslProc.input = srcDoc;
  // add the parameters used inside the stylesheet
  xslProc.addParameter("Hora", Hora, "");
  xslProc.addParameter("Fecha", Fecha, "");
  xslProc.addParameter("IdCd", IdCd.toString(), "");
  // perform the XSL Transformation
  xslProc.transform();
  // write result to browser
  Response.Write(xslProc.output);
  return true;
}
...
...
%>

HTH,
<prs/>

-----Original Message-----
From: Steve Brown [mailto:stevebrown@xxxxxxxxx] 
Sent: Thursday, May 27, 2004 12:05 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] NEED good information on alternative for dyn:evaluate()
for MSXML

M:D,
I understand your confusion, because your point is valid.
But, the catch is this I am going to be passing a new a probably different
pre-generated XPath expession to the param each time the stylesheet is
called.
So, instead of hard coding the param into the select it needs to variable.
Hope that helps.
Thanks,
~Steve

On Thu, 27 May 2004 10:53:42 -0600, M. David Peterson <m.david@xxxxxxxxxx>
wrote:
> 
> Hey Steve,
> 
> Im confused... What part of $filter, or better
> "//person[contains(FName,'a') and LName='Brown']" yet from a string to 
> XPath?  It is already XPath.
> 
> When I run this code as such...
> 
> <?xml version="1.0"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
> version="1.0">
> 
> <xsl:param name="filter" select="//person[contains(FName,'a') and 
> LName='Brown']"/>
> 
> <xsl:template match="/">
>         <xsl:apply-templates select="$filter"/> </xsl:template> 
> <xsl:template match="person">
>   <xsl:value-of select="LName"/>, <xsl:value-of select="FName"/> 
> </xsl:template> </xsl:stylesheet>
> 
> I get the expected output of:
> 
> Brown, Allan
> 
> Can you clarify a bit further?
> 
> Thanks!
> 
> <M:D/>
> 
> 
> 
> > -----Original Message-----
> > From: Steve Brown [mailto:stevebrown@xxxxxxxxx]
> > Sent: Thursday, May 27, 2004 10:43 AM
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject: Re: [xsl] NEED good information on alternative for
> dyn:evaluate()
> > for MSXML
> >
> > M:D,
> > Thanks for the link.
> > There is plenty to learn from it, but the string I am looking to 
> > evaluate is a bit more complex...
> > Here are some code snippets for reference.
> >
> > XSL:
> > <xsl:param name="filter" select="//person[contains(FName,'a') and 
> > LName='Brown']"/>
> >
> > <xsl:template match="/">
> >       <xsl:apply-templates select="$filter"/>  (this is what does 
> > not work, some parsers offer a evaluate function to convert a string 
> > to XPath but not MSXML) </xsl:template>
> >
> > XML:
> > <person>
> >   <FName>Allan</FName>
> >   <LName>Brown</LName>
> >   ....
> > </person>
> >
> > Thanks again,
> > ~Steve
> >
> >
> > On Thu, 27 May 2004 10:17:20 -0600, M. David Peterson 
> > <m.david@xxxxxxxxxx> wrote:
> > >
> > > Hey Steve,
> > >
> > > Without a code sample I can't tell you if this particular solution
> will
> > > give you what you want.  But my Yahoo! style directory post from a
> few
> > > weeks ago may contain the solution to your problem.
> > >
> > > Heres the link to that posting...
> > >
> > > http://www.biglist.com/lists/xsl-list/archives/200405/msg00288.htm
> > > l
> > >
> > > To save you from having to mull through the code and documentation
> the
> > > code takes this string parameter...
> > >
> > > <xsl:param name="dirPath" select="'Main/Computers/WWW'"/>
> > >
> > > Breaks it down into its individual parts and then compares each 
> > > part
> to
> > > the source XML, outputting the children of the final node as a
> Yahoo!
> > > style directory...
> > >
> > > Let me know if this doesn't get you to where you need to go and I
> will
> > > try and help you further...
> > >
> > > Best regards,
> > >
> > > <M:D/>
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: Steve Brown [mailto:stevebrown@xxxxxxxxx]
> > > > Sent: Thursday, May 27, 2004 9:16 AM
> > > > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > > > Subject: [xsl] NEED good information on alternative for
> dyn:evaluate()
> > > for
> > > > MSXML
> > > >
> > > > I'm sure this question is probably an FAQ, but I've been digging 
> > > > around the web for a couple of days trying to find a work around
> for
> > > > converting a string to XPath for MSXML4 and haven't been able to
> find
> > > > the right place.
> > > > The way I understand it is you have to write an extension, but 
> > > > I'm
> not
> > > > clear on how to do that.  Plus, I have a feeling that someone 
> > > > else
> has
> > > > invented that wheel.
> > > > I'm not apposed to switching XSL parsers, but I if I do it needs
> work
> > > with
> > > > ASP.
> > > > Thanks,
> > > > ~Steve

Current Thread