Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8167179

Make XSL generated namespace prefixes local to transformation process

XMLWordPrintable

    • b142

        Transformations that utilizes 'namespace-uri()' function generates different namespace prefixes.
        As a result subsequent transformations of the same XML content with the same XSL will result in different content generated.
        The example of two subsequent iterations results can be:
        Iteration 1:
        <?xml version="1.0" encoding="UTF-8"?>
        <ns0:TestRoot xmlns:ns0="test.xmlns">
        <ns1:Element1 xmlns:ns1="test.xmlns">
        </ns1:Element1>
        <ns2:Element2 xmlns:ns2="test.xmlns">
        </ns2:Element2>
        </ns0:TestRoot>

        Iteration 2:
        <?xml version="1.0" encoding="UTF-8"?>
        <ns3:TestRoot xmlns:ns3="test.xmlns">
        <ns4:Element1 xmlns:ns4="test.xmlns">
        </ns4:Element1>
        <ns5:Element2 xmlns:ns5="test.xmlns">
        </ns5:Element2>
        </ns3:TestRoot>

        Such behavior can lead to the high memory usages by cached transformer/templates instances: The unique namespace prefixes will be stored in Xerces SymbolTable associated with the cached transformer. The BasisLibrary::generatePrefix method should be fixed to generate the same prefixes numbers for each transformation operation, i.e. the prefix index counter should be made thread local and needs to be reset during the start of each transformation process.

              aefimov Aleksej Efimov
              shadowbug Shadow Bug
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: