[Yanel-dev] BasicXML resource and i18n

Michael Wechner michael.wechner at wyona.com
Thu Aug 25 12:07:48 CEST 2011


Hi

I have just noticed that the BasicXML resource does only "allow" to set 
i18n keys in the very last XSLT, because the way it is implemented

             // chain everything together (create a pipeline):
             if (xsltHandlers.length > 0) {
                 xmlReader.setContentHandler(xsltHandlers[0]);
                 for (int i=0; i<xsltHandlers.length-1; i++) {
                     xsltHandlers[i].setResult(new 
SAXResult(xsltHandlers[i+1]));
                 }
                 xsltHandlers[xsltHandlers.length-1].setResult(new 
SAXResult(xIncludeTransformer));
             } else {
                 xmlReader.setContentHandler(new 
SAXResult(xIncludeTransformer).getHandler());
             }
             xIncludeTransformer.setResult(new SAXResult(i18nTransformer));
             i18nTransformer.setResult(new 
SAXResult(serializer.asContentHandler()));
             serializer.setOutputStream(baos);

all i18n keys which might be set earlier are possibly ignored by some 
following XSLTs.
(The same is true for the xinclude transformer)

I think there are at least two workarounds for this

- Either apply the i18n after each XSLT (maybe make this configurable 
via the resource configuration, because of performance reasons)
- Copy the i18n keys with each XSLT (which means one needs to be aware 
of this and also do some manual work)

WDYT?

Thanks

Michael


More information about the Yanel-development mailing list