I tried the patch on a couple of stylesheets that I am working on, and everything works great. Thanks for getting this patch out so fast. You guys are really on the ball.
Dan
-----Original Message-----
From: Kaiserovi [mailto:[EMAIL PROTECTED]]
Sent: Saturday, October 21, 2000 11:41 AM
To: Sablotron Mailing List
Subject: Re: [Sab] Missing current() function
Daniel,
thanks, it was a bug, and one pretty hard to trace. Apply the enclosed
patch in the engine subdirectory. I'll be grateful if you test it in a
few more situations.
Tom
------------------------------------patch begins
Index: expr.cpp
===================================================================
RCS file: d:/cvs-master/ga/src/Sablot/engine/expr.cpp,v
retrieving revision 1.18
diff -a -u -r1.18 expr.cpp
--- expr.cpp 2000/09/12 14:50:08 1.18
+++ expr.cpp 2000/10/21 15:39:58
@@ -3021,12 +3029,12 @@
}
*/
-eFlag Expression::createLPContext(Context *&c, int baseNdx)
+eFlag Expression::createLPContext(Context *&c, int baseNdx, Vertex
*givenGlobalCurrent /* = NULL */)
{
assert(functor == EXF_LOCPATH);
Context *theResult = new Context,
info;
- info.setCurrentNode(c -> current());
+ info.setCurrentNode(givenGlobalCurrent ? givenGlobalCurrent : c ->
current());
theResult -> setCurrentNode(c -> getCurrentNode());
E( createLPContextLevel(0, args.number(), c -> current(), info,
theResult) );
theResult -> sort();
@@ -3124,7 +3132,7 @@
}
-eFlag Expression::createLPContextSum(Context *&c)
+eFlag Expression::createLPContextSum(Context *&c, Vertex *globalCurrent
/* = NULL */)
{
assert(functor == EXF_LOCPATH);
Context
@@ -3133,7 +3141,7 @@
int cNumber = c -> getSize();
for (int j = 0; j < cNumber; j++)
{
- E( createLPContext(returnedc = c, j) );
+ E( createLPContext(returnedc = c, j, globalCurrent) );
newc2 = newc -> swallow(returnedc);
delete newc;
newc = newc2;
@@ -3204,6 +3212,11 @@
{
assert(baseNdx != -1); // meaningful only for a locpath
E( args[0] -> createContext(newc = c, baseNdx) );
+
+ /// tom 21-10-00
+ /// wild guess:
+ newc -> setCurrentNode(c -> getCurrentNode());
+
Context *filteredc;
for (i = 1; i < argsNumber - (int) hasPath; i++)
{
@@ -3224,7 +3237,7 @@
};
if (hasPath)
{
- E( args[argsNumber-1] -> createLPContextSum(filteredc =
newc) );
+ E( args[argsNumber-1] -> createLPContextSum(filteredc =
newc, newc -> getCurrentNode()) );
delete newc;
newc = filteredc;
}
Index: expr.h
===================================================================
RCS file: d:/cvs-master/ga/src/Sablot/engine/expr.h,v
retrieving revision 1.8
diff -a -u -r1.8 expr.h
--- expr.h 2000/08/11 15:00:37 1.8
+++ expr.h 2000/10/21 15:19:05
@@ -372,8 +372,8 @@
eFlag matchesSingleStep(Vertex *v, Bool &result);
eFlag createLPContextLevel(int stepLevel, int stepsCount,
Vertex *base, Context& info, Context *theResult);
- eFlag createLPContext(Context *&, int);
- eFlag createLPContextSum(Context *&);
+ eFlag createLPContext(Context *&, int, Vertex *globalCurrent =
NULL);
+ eFlag createLPContextSum(Context *&, Vertex *globalCurrent = NULL);
Bool
isPattern;
------------------------------------patch ends
> "Hammond, Daniel" wrote:
>
> I am using the .44 Windows version. I was wrong, the function present
> since it runs my stylesheet without complaints. Before it was
> supported, current() used to exit with an error. I think I have found
> an odd case where current() doesn't seem to work though. The
> following xml and xsl files generate the expected output when using
> Saxon but not using Sablotron:
>
> Note: There are a couple of lines in the XSL file that are commented
> out. If you uncomment these, and comment out the line directly above
> each, everything works as expected (Assuming cat.xml is passed into
> Sablotron on the command line).
- - - - - - - Appended by Scientific-Atlanta, Inc. - - - - - - -
This e-mail and any attachments may contain information which is confidential, proprietary, privileged or otherwise protected by law. The information is solely intended for the named addressee (or a person responsible for delivering it to the addressee). If you are not the intended recipient of this message, you are not authorized to read, print, retain, copy or disseminate this message or any part of it. If you have received this e-mail in error, please notify the sender immediately by return e-mail and delete it from your computer.
