You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Sergei S. Ivanov" <iv...@aha.ru> on 2000/08/01 18:29:26 UTC

[BUG+FIX] generate-id()

Hello all

XSLT spec says: "The unique identifier [produced by generate-id()] must
consist of ASCII alphanumeric characters and must start with an alphabetic
character."
Xalan sometimes generates ids like N-1234, because the implementation uses
hash code, which is not always non-negative. The proposed fix is:

\org\apache\xalan\xpath\FuncGenerateId.java
97c97
<                          ? "" :
"N"+Integer.toString(dtmp.getDTMNodeNumber()));
---
>                          ? "" :
"N"+Integer.toHexString(dtmp.getDTMNodeNumber()));
102c102
<                          ? "" : "N"+Integer.toString(context.hashCode()));
---
>                          ? "" :
"N"+Integer.toHexString(context.hashCode()));

Regards,
--
Sergei S. Ivanov  sergei_ivanov@object-tools.com
Object Tools, Moscow  http://www.object-tools.com