You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Michael Glenn <mi...@mglenn.com> on 2000/03/07 18:18:29 UTC

Multiple XSLT Pass Bug?

Earlier I posted a question regarding multiple xml-stylesheet PIs
(processing instructions) and multiple Cocoon PIs within one XML file
for multiple passes. The reactor model implied this was possible however
it is only possible currently with different processing types xslt, xsp,
etc.

I wanted to bounce this off the group before making the changes to
ensure I'm not missing a concept.

In XSLTProcessor.java within the getResource(Document, String, String)
function lines 113 & 114

Enumeration pis = Utils.getAllPIs(document, STYLESHEET_PI).elements();
while (pis.hasMoreElements()) {

retrieves all stylesheet PIs and then enumerates through them all. Why
are we grabbing all of them, leaving them in the document (note the
boolean value true is not passed) and then through the enumeration only
returning one resource?

Would it not be better to do the following?

Enumeration pis = Utils.getFirstPI(document, STYLESHEET_PI,
true).elements();
if(pis.hasMoreElements()) {

This would grab the first stylesheet PI, remove it, retrieve the first
resource , process and leave any additional Cocoon PI's and their
associated stylesheet PIs for another pass. 

Am I missing something or would this help?

Thanks.

-- 
Michael Glenn, http://www.mglenn.com
Principal and Web Architect
North 49 Design
http://www.north49design.com

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: PGPfreeware 6.5.2 for non-commercial use <http://www.pgp.com>

mQGiBDi1W3gRBADgkh1Qvms9Qz1zpStGDdSs36K0KGX8mhuXMn21C6cE9DQ4V6d7
S8yQo+fFwos0lV+iIy0vWomq2LI1tiniV46v8cn7OyM0QI2c4IVgNn7h5hwq8Yue
RmdSk9Nc1B8FJjWXZKkAxrZ9UtBRpl1USUnh8NnN0uQ+4pB9QoRK77OFnQCg/8hh
KqMCe7y3FF5jHtSK/pHT308D/ifQNxg97Sp1BQxrOGA07Jj4MbWwZDUZH3h0loSJ
TmqEZU8dykPFu3+MCgiUP6en2b5Qk0r/ayHiS7cOwCMUnsmI2Ys4TC36w2CXIhUh
yt8xWqR8uGJDw3OsRr4bOgOm2rhcBtsCx4CSCZ80ysWcDT2KERg4l9kgP1poI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d547AJ9ze+4zXlsv/NdX
GhsLTWp+BOQEvACgqEN5l2RiBVEYJDx1ktz9cSuvcrI=
=KXHB
-----END PGP PUBLIC KEY BLOCK-----

Re: Multiple XSLT Pass Bug?

Posted by Michael Glenn <mi...@mglenn.com>.
Michael Glenn wrote:
> 
> Earlier I posted a question regarding multiple xml-stylesheet PIs
> (processing instructions) and multiple Cocoon PIs within one XML file
> for multiple passes. The reactor model implied this was possible however
> it is only possible currently with different processing types xslt, xsp,
> etc.
> 
> I wanted to bounce this off the group before making the changes to
> ensure I'm not missing a concept.

[deletia]

Actually that code was an over simplification as the return type for
getFirtPI is a ProcessingInstruction not a Vector but the fully updated
code is attached. It did a quick test with multiple XSL translations and
they worked just fine. Further testing of course is needed but please
let me know if I've completely missed something.

I haven't checked whether this problem exists in other processors.

Thanks.

-- 
Michael Glenn, http://www.mglenn.com
Principal and Web Architect
North 49 Design
http://www.north49design.com

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: PGPfreeware 6.5.2 for non-commercial use <http://www.pgp.com>

mQGiBDi1W3gRBADgkh1Qvms9Qz1zpStGDdSs36K0KGX8mhuXMn21C6cE9DQ4V6d7
S8yQo+fFwos0lV+iIy0vWomq2LI1tiniV46v8cn7OyM0QI2c4IVgNn7h5hwq8Yue
RmdSk9Nc1B8FJjWXZKkAxrZ9UtBRpl1USUnh8NnN0uQ+4pB9QoRK77OFnQCg/8hh
KqMCe7y3FF5jHtSK/pHT308D/ifQNxg97Sp1BQxrOGA07Jj4MbWwZDUZH3h0loSJ
TmqEZU8dykPFu3+MCgiUP6en2b5Qk0r/ayHiS7cOwCMUnsmI2Ys4TC36w2CXIhUh
yt8xWqR8uGJDw3OsRr4bOgOm2rhcBtsCx4CSCZ80ysWcDT2KERg4l9kgP1poI27x
l38MA/9cJiLDhT84+ktmTpwkzDIbBWqBEa9avd28fMLjziJMw6Ak2a5B3lONDBWD
ymd0UHjuuHm3aXDA2xAiZtQRvYpEFKsIOoL6+eMjkDC2VfEjo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