[xsl] XPath condition testing, can pretty-print affect?

Subject: [xsl] XPath condition testing, can pretty-print affect?
From: Karlmarx R <karlmarxr@xxxxxxxxx>
Date: Fri, 28 Oct 2011 04:00:39 +0800 (SGT)
Hello,
 
I have a xpath issue which seems bit weird. Let me explain: My XML
inputs usually come in single line and whenever a new conditions are required,
usually I pretty-print that input XML and write required XPath rules which
will be executed by XMLProbe. So far, many rules are written like this and no
problem reported so far. BUT, today a problem was reported and upon further
investigation what I found was doing "pretty-print" affect the outcome!
 
Skeleton sample without pretty-print:
<root
xmlns:....><Desc><dc:title><sc>TEXT</sc></dc:title><Many-Other-elements/></De
sc></root>

 
My XMLProbe xpath rule is:
<silcn:expression>
               
$Desc/dc:title[not(text()) or match-regexp('^[^0-9a-zA-Z]*$', .)]
</silcn:expression>


Basically trying to check whether any single Alpha-Num
char is present. If not, report error. Now the input XML after pretty-print
using oxygen (ctrl+shift+i) looks perfectly alright, like:
 
<root xmlns:....>
    <Desc>
        <dc:title>
            <sc>TEXT</sc>
        </dc:title>
        <Many-Other-elements/>
    </Desc>
</root>
 
The previously mentioned
xpath rule perfectly works in the 2nd case, after pretty-print. But the rule
does not give desired output on the source one-liner XML. Inspite of
<dc:title/> having TEXT, it keeps sending the failure massage which is not
what is expected. I do understand in certain cases pretty-print can affect
certain things, but I have not explored much in this matter and any suggestion
or pointer towards this would be of help.
 
Thanks in advance,
Karl

Current Thread