+Sat Sep 6 09:57:03 PDT 2003 William Brack <wbrack@mmm.com.hk>
+
+ * pattern.c pattern.h imports.c: fixed bug 119946, caused by
+ incorrect creation of "extra" variables when compiling
+ templates on imported stylesheets.
+ * tests/docs/Makefile.am tests/docs/bug-130.xml tests/docs/bug-130.doc
+ tests/general/Makefile.am test/docs/bug-130*: added tests
+ to the regression suite for this bug.
+
Wed Sep 3 15:33:40 CEST 2003 Daniel Veillard <daniel@veillard.com>
* tests/xmlspec/*.html: tyny change HTML -> html DOCTYPE due to
#include "imports.h"
#include "documents.h"
#include "security.h"
-
+#include "pattern.h"
/************************************************************************
res->parent = style;
res->next = style->imports;
style->imports = res;
+ xmlHashScan(res->templatesHash,
+ (xmlHashScanner) xsltNormalizeCompSteps, style);
style->extrasNr += res->extrasNr;
ret = 0;
} else {
}
/**
+ * xsltNormalizeCompSteps:
+ * @payload: pointer to template hash table entry
+ * @data: pointer to the stylesheet
+ * @name: template match name
+ *
+ * This is a hashtable scanner function to normalize the compiled
+ * steps of an imported stylesheet.
+ */
+void xsltNormalizeCompSteps(void *payload,
+ void *data, const xmlChar *name) {
+ xsltCompMatchPtr comp = payload;
+ xsltStylesheetPtr style = data;
+ int ix;
+
+ for (ix = 0; ix < comp->nbStep; ix++) {
+ comp->steps[ix].previousExtra += style->extrasNr;
+ comp->steps[ix].indexExtra += style->extrasNr;
+ comp->steps[ix].lenExtra += style->extrasNr;
+ }
+}
+
+/**
* xsltNewParserContext:
* @style: the stylesheet
* @ctxt: the transformation context, if done at run-time
xsltTestCompMatchList (xsltTransformContextPtr ctxt,
xmlNodePtr node,
xsltCompMatchPtr comp);
+XSLTPUBFUN void XSLTCALL
+ xsltNormalizeCompSteps (void *payload,
+ void *data,
+ const xmlChar *name);
/*
* Template related interfaces.
bug-127.xml \
bug-128.xml \
bug-129.xml \
+ bug-130.xml bug-130.doc \
character.xml \
array.xml \
items.xml
--- /dev/null
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<document>
+<header></header>
+<article><title>title #1</title></article>
+<article><title>title #2</title></article>
+</document>
+
--- /dev/null
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<?xml-stylesheet type="text/xsl" href="./transform.xsl"?>
+<frame content="./content.xml"/>
+
bug-127.out bug-127.xsl \
bug-128.out bug-128.xsl \
bug-129.out bug-129.xsl \
+ bug-130.out bug-130.xsl \
+ bug-130-imp1.imp bug-130-imp2.imp bug-130-imp3.imp bug-130-imp4.imp \
character.out character.xsl \
character2.out character2.xsl \
itemschoose.out itemschoose.xsl \
--- /dev/null
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:template match="article">
+ <xsl:text>article in module #1;</xsl:text>
+ <xsl:apply-templates/>
+</xsl:template>
+
+
+<xsl:template match="title">
+ <xsl:text>title in module #1;</xsl:text>
+</xsl:template>
+
+
+<xsl:template match="header">
+ <xsl:text>header #1 in module #1;</xsl:text>
+</xsl:template>
+
+
+<xsl:template match="header[logo]">
+ <xsl:text>header #2 in module #1;</xsl:text>
+</xsl:template>
+
+</xsl:stylesheet>
--- /dev/null
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:template match="article[position()=1]/title">
+ <xsl:text>title #1 in module #2;</xsl:text>
+</xsl:template>
+
+
+<xsl:template match="article[position()>1]/title">
+ <xsl:text>title #2 in module #2;</xsl:text>
+</xsl:template>
+
+</xsl:stylesheet>
--- /dev/null
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:template match="document">
+ <xsl:text>document in module #3;</xsl:text>
+ <xsl:apply-templates select="article"/>
+</xsl:template>
+
+
+<xsl:template match="article[position()=1]">
+ <xsl:text>article in module #3;</xsl:text>
+ <xsl:apply-templates select="title"/>
+</xsl:template>
+
+</xsl:stylesheet>
--- /dev/null
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:template match="frame">
+ <div>
+ <xsl:apply-templates select="$g.doc.root/document/header"/>
+ <xsl:apply-templates select="$g.doc.root/document"/>
+ </div>
+</xsl:template>
+
+
+<xsl:template match="header">
+ <xsl:text>header #1 in module #4;</xsl:text>
+</xsl:template>
+
+
+<xsl:template match="header[logo]">
+ <xsl:text>header #2 in module #4;</xsl:text>
+</xsl:template>
+
+</xsl:stylesheet>
--- /dev/null
+<html xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body><div xmlns="">header #1 in module #4;document in module #3;article in module #3;title #1 in module #2;article in module #1;title #2 in module #2;</div></body></html>
--- /dev/null
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns="http://www.w3.org/TR/REC-html40">
+
+<xsl:import href="./bug-130-imp1.imp"/>
+<xsl:import href="./bug-130-imp2.imp"/>
+<xsl:import href="./bug-130-imp3.imp"/>
+<xsl:import href="./bug-130-imp4.imp"/>
+
+<xsl:output method="html" indent="no"/>
+
+<xsl:variable name="g.doc.root" select="document('../docs/bug-130.doc')"/>
+
+<xsl:template match="/">
+ <html>
+ <head></head>
+ <body><xsl:apply-templates select="/frame"/></body>
+ </html>
+</xsl:template>
+
+</xsl:stylesheet>