DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9018>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9018

document() function not working if xsl templates loaded from a byte stream

           Summary: document() function not working if xsl templates loaded
                    from a byte stream
           Product: XalanJ2
           Version: 2.0.0
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: org.apache.xalan.xsltc
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


I'm not sure if this is a bug or just a misunderstanding on my part but any 
help would be appreciated.

I have made a small modification to my copy of org.apache.xalan.xslt.Process so 
that it reads in the xsl template and then decrypts it before processing.

See following code fragment.  The else part is what it used to do.

// Handles encrypted .xok files and non-encrypted .xsl files
if (xslFileName.endsWith(".xok"))
{
  InputStream in = new FileInputStream(xslFileName);

  java.io.ByteArrayOutputStream out = new java.io.ByteArrayOutputStream();

  // Decrypt the file
  int index = 0;
  while(in.available() > 0)
  {
        out.write(OktEncrypt.decrypt(in.read(), index));
        index++;
  }

  stylesheet = tfactory.newTemplates(new StreamSource(new 
java.io.ByteArrayInputStream(out.toByteArray())));
}
else
  stylesheet = tfactory.newTemplates(new StreamSource(xslFileName));

So basically the only difference is that the templates are loaded from memory 
instead of directly from a file.

What I am finding is that if I use the document() function in my xsl to read in 
another XML file then it doesn't seem to work at all.  I am calling it with an 
absolute path C:\xxx

I would have thought this would still work.  Any suggestions as to why it 
doesn't?

Thanks, Damon

Reply via email to