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: sara.mitchell@xxxxxxxxx
Date: Mon, 18 Sep 2000 20:01:44 -0400
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


Current Thread