RE: Has document(string) in MSXML 3 (July preview) worked for any one?

Subject: RE: Has document(string) in MSXML 3 (July preview) worked for any one?
From: Andrew Kimball <akimball@xxxxxxxxxxxxx>
Date: Mon, 18 Sep 2000 18:06:40 -0700
Sara,

There is a way to pass parameters to stylesheets, just not through the
selectNodes interface (that's now just a convenience function for the full
XSLTemplate/XSLProcessor objects).  For more details, see the documentation
that comes with the 3.0 SDK download.  Lookup "IXSLProcessor, addParameter"
and "XSLTemplate examples" for information and example code.

BTW, your solution below was the recommended way to simulate parameters
using the IE5 release of XSL (2.5).  That is no longer necessary with 3.0.

~Andy Kimball
MSXSL Dev


-----Original Message-----
From: sara.mitchell@xxxxxxxxx [mailto:sara.mitchell@xxxxxxxxx]
Sent: Monday, September 18, 2000 5:02 PM
To: xsl-list@xxxxxxxxxxxxxxxx
Subject: RE: Has document(string) in MSXML 3 (July preview) worked for
any one?
Sensitivity: Private


Thanks to all of you that passed along suggestions on this issue. 
I have fixed the problem, and it was, as suspected, caused by 
MSXML not having a 'base URI' for the document because everything
is happenind in memory. 

I'm posting my solution, in case someone else needs this. 
The solution, which seems rather extreme to me, is to change
the stylesheet in memory using DOM. Microsoft apparently has no
way to pass in a parameter in the call to the parser/XLST processor
which is what I would have preferred as a solution (is anyone 
from Microsoft listening? :-)

I didn't want to change the stylesheet in memory as this same 
document will later have to go through XT, but I did find a 
way to 'mimic' the parameter passing facility so that the 
stylesheet should work properly for XT also. 

Here's the pertinent snippet from the stylesheet: 

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">

<xsl:output method="html" version="4.0" indent="yes"/>

<xsl:param name="docpath"/>

<xsl:param name="shrdict">
<xsl:choose>
 <xsl:when test="contains($docpath,'casper')">
  <xsl:value-of
select="concat(translate(substring-before($docpath,'casper'),'|',':'),'shrxm
l/dictionary/ebizglos.xml')"/> 
 </xsl:when>
 <xsl:when test="contains($docpath,'services')">
  <xsl:value-of
select="concat(translate(substring-before($docpath,'services'),'|',':'),'shr
xml/dictionary/ebizglos.xml')"/> 
 </xsl:when>
 <xsl:otherwise>noshare</xsl:otherwise>
</xsl:choose>
</xsl:param>
...

The parameter 'shrdict' ends up with the fully qualified path
to the second document that needs to be opened. It uses 'docpath'
to get the path to the XML document that is primarily being
rendered. 

The parameter 'docpath' gets a URL passed in. For XT, this is 
passed using the standard methods. For MSXML, the value of 
the parameter is 'passed' by changing the stylesheet in memory
in the JScrip macro run from XMetal:

...
//Pass the active document path into the stylesheet as a global-parameter
  var partialpath = ActiveDocument.Path;
  partialpath = partialpath.replace(':','|');
  partialpath = partialpath.replace('\\+','/');
  var newpath = xsldoc.createTextNode(partialpath);

  var param = xsldoc.selectSingleNode("//xsl:param[@name='docpath']");
  param.appendChild(newpath);
... 

Sara


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread