xsl-list
[Top] [All Lists]

RE: error in XSL file when using JAXP

2005-07-28 05:14:31
Hi Michael and David

I installed the latest version of the XSL Editor and
debugged my program as it started giving me the same
error as my JAXP.

I made the changes that both of you suggested and now
my program is working fine !

Thanks a lot for all your help.

Rahil

--- Michael Kay <mike(_at_)saxonica(_dot_)com> wrote:

test="distinct-values($aVal[for $a in .
return

normalize-space($oVal)[contains(lower-case(.),lower-case($a))]])

I think you're trying to test whether at least one
of the values in $aVal
satisfies some condition.

Firstly, I can't see why you're removing duplicates.
If some $x in
distinct-values(X) satisfies a condition, then some
$x in X must satisfy the
condition, so removing duplicates is unnecessary
work.

So this reduces to 

test="exists($aVal[for $a in .
return

normalize-space($oVal)[contains(lower-case(.),lower-case($a))]])

But this is still fishy. normalize-space() returns
either a string or
nothing (an empty sequence). So it's an odd thing to
apply a predicate to. I
think this reduces to


test="exists($aVal[contains(lower-case(normalize-space(.)),
lower-case($a))])"

or if you prefer

test="some $v in $aVal satisfies
contains(lower-case(normalize-space($v)),
lower-case($a))"

This isn't precisely equivalent to the meaning of
your expression under the
earlier version of the spec, but I suspect it's what
you intended. For
example if distinct-values returns a single
zero-length string then the EBV
is false, but exists() return true.

Michael Kay
http://www.saxonica.com/

-----Original Message-----
From: Rahil Qamar [mailto:qamar_rahil(_at_)yahoo(_dot_)co(_dot_)uk]

Sent: 28 July 2005 11:56
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] error in XSL file when using
JAXP

Thanks David and Michael

Okay at least I think I know where the problem is
arising now.

I have a section of code soon after the for-each
loop
which tests for the common values present in both
the
XML files imported at the start of the XSL.

The lines are:
-----------
<xsl:choose>
   <xsl:when test="distinct-values($aVal[for $a in
.
return


normalize-space($oVal)[contains(lower-case(.),lower-case($a))]])">

    <xsl:variable name="matchingVals"
select="distinct-values($aVal[for $a in . return


normalize-space($oVal)[contains(lower-case(.),lower-case($a))]])"/>
                                    
    <xsl:if test="not(empty($matchingVals))">
----------
Now the variable $matchingVals does not contain
nodes
but common atomic values.

Is there any other way of writing out this test
case
so that I can deal with the new version processor
requirements?

Note: $aVal and $oVal are -
----------
////$arch = File1.xml
////$ont = File2.xml
<xsl:variable name="aVal"
select="$arch/SubConcepts/SubConcept/Value"/>
            
<xsl:for-each
select="$ont/SubConcepts/SubConcept">
     <xsl:variable name="oVal" select="."/>

---------

Thanks
Rahil

--- David Carlisle <davidc(_at_)nag(_dot_)co(_dot_)uk> wrote:


Line 162 in the said file is :

That is not the line with generating the error
though. (Line numbering
can easily be out due to vagaries in dos/unix
line
ends etc.

The error means that you have something like

test="zzzz"  or  ... [zzzzz]  and zzz evaluates
to a
sequence whose
first item is not a node but is a number or a
string
or some other
atomic value.  If the sequence doesn't consist
of
nodes then to use it
as a boolean in a test it has to consist of a
single
item, which is a
boolean value either true or false. If the
sequence
is a sequence of
nodes then, as in xpath1 it will count as false
if
it is empty and true
otherwise.

David





______________________________________________________________
__________
This e-mail has been scanned for all viruses by
Star. The
service is powered by MessageLabs. For more
information on a proactive
anti-virus service working around the clock,
around
the globe, visit:
http://www.star.net.uk



______________________________________________________________
__________




--~------------------------------------------------------------------
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>
--~--





            


___________________________________________________________

How much free photo storage do you get? Store your
holiday 
snaps for FREE with Yahoo! Photos
http://uk.photos.yahoo.com



--~------------------------------------------------------------------
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>
--~--






--~------------------------------------------------------------------
XSL-List info and archive: 
http://www.mulberrytech.com/xsl/xsl-list

=== message truncated ===



                
___________________________________________________________ 
How much free photo storage do you get? Store your holiday 
snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com

--~------------------------------------------------------------------
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>
--~--