diff options
author | Stewart Brodie <stewart@eh.org> | 2012-11-21 11:11:46 +0800 |
---|---|---|
committer | Daniel Veillard <veillard@redhat.com> | 2012-11-21 11:11:46 +0800 |
commit | d204e66735cb701e5b76e1489353faa48cfc6016 (patch) | |
tree | ea58a5a1e27eb96bd17c1e3418794245fb561092 | |
parent | c87cd842f81a68e4aad6bcd45c20712c5c5a2bc1 (diff) | |
download | libxslt-d204e66735cb701e5b76e1489353faa48cfc6016.tar.gz libxslt-d204e66735cb701e5b76e1489353faa48cfc6016.tar.bz2 libxslt-d204e66735cb701e5b76e1489353faa48cfc6016.zip |
Fix generate-id() to avoid generating the same ID
For nodes from different documents, especially for the document
node itself which would always get "idp0" as a result.
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=688171
-rw-r--r-- | libxslt/functions.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libxslt/functions.c b/libxslt/functions.c index c754994e..dc619945 100644 --- a/libxslt/functions.c +++ b/libxslt/functions.c @@ -660,6 +660,7 @@ xsltFormatNumberFunction(xmlXPathParserContextPtr ctxt, int nargs) */ void xsltGenerateIdFunction(xmlXPathParserContextPtr ctxt, int nargs){ + static char base_address; xmlNodePtr cur = NULL; xmlXPathObjectPtr obj = NULL; long val; @@ -716,7 +717,7 @@ xsltGenerateIdFunction(xmlXPathParserContextPtr ctxt, int nargs){ if (obj) xmlXPathFreeObject(obj); - val = (long)((char *)cur - (char *)doc); + val = (long)((char *)cur - (char *)&base_address); if (val >= 0) { sprintf((char *)str, "idp%ld", val); } else { |