File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes problem with processing instructions and variables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "problem with processing instructions and variables" Watch "problem with processing instructions and variables" New topic
Author

problem with processing instructions and variables

Kelly Dolan
Ranch Hand

Joined: Jan 08, 2002
Posts: 109
I'm working in some legacy code and encountering a very strange problem.

I have XML that contain <title> elements and the value of these elements contain processing instructions. On application of XSL, the output contains [%{#:#}%] where # is either blank or some number. What I've discovered so far is...

1. It seems to occur when the value of the title is stored in a variable. (e.g., <xsl:variable name=blah><xsl:value-of select=normalize-space() /></xsl:variable>)
2. The use of text() or "." instead of normalize-space() does not change matters.
3. If I don't use a variable and pass normalize-space() to the thing that is actually using it, things work.
4. I do not experience this in plain Java. i.e., using Java objects to perform the transformation
5. I do not experience this in plain IE. i.e., where the XML file references the XSL file and performs the transformation
6. I do not experience this in plain JavaScript. i.e., when I write a script function that uses the IE ActiveX objects (3.0)
7. I experience this in IE8 w/ code that uses the IE ActiveX objects (3.0). The difference between this code and the sample I wrote for (5) is unknown ... the real code is very cryptic and mostly generated so it's a slow process trying to figure out what exactly is going on.

So, just curious - has anyone seen this before and know what to do? Any suggestions on where else I might be able to find an answer? Currently, I'm trying to find occurrences of this and avoid the use of variables but I'm finding it difficult in some locations.

Thanks!
g tsuji
Ranch Hand

Joined: Jan 18, 2011
Posts: 539
    
    3
If that is what observed, could you post a small test sample (probably reflecting some essential/local aspect of the xml/xsl you're working on) demonstrating the problem?
Kelly Dolan
Ranch Hand

Joined: Jan 08, 2002
Posts: 109
To close out this thread, I found where the funky character pattern was coming from...somewhere within our own code. So, this isn't a problem w/ XSLT in general.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem with processing instructions and variables