xsl-list
[Top] [All Lists]

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

2011-10-27 15:00:55
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/></Desc></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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>