xsl-list
[Top] [All Lists]

unable to resolve intersect/union operator

2005-05-19 05:02:01
Hi

Im trying to match the inner values of the <A> and <B> nodes to see if they contain any similar results. I tried the 'intersect' operator but it doesnt work with my expression. I tried a few permutations and combinations and at one point I got a compile-time error
--------------------
[SAXON 8.1.1 from Saxonica] Starting transformation ...
FATAL ERROR: Required item type of first operand of '|' is node(); supplied value has item type xs:string; SystemID: file:/D:/Coding/Samples/Final/CanonicalMapping2.xsl; Line#: 57; Column#: -1
FATAL ERROR: Failed to compile stylesheet. 1 error detected.

Transformation Interrupted!
--------------------

This was when I tried
<xsl:variable name="interim" select="/TopConcept/*[name()=$ATerm]"/>
<xsl:if test="normalize-space($interim/A/text()) intersect normalize-space($interim/B/text())">
   <intersect>intersect</intersect>
</xsl:if>
_--------------------------------------------------------------------------------------------------------------------------------

I tried other options as well (shown below) but none worked

<xsl:if test="$interim/A union $interim/B">
   <union>union</union>
<xsl:message>Results=<xsl:value-of select="$interim/A union $interim/B"/></xsl:message>
</xsl:if>
----Enters the block but doesnt throw results as expected: Parts, Handle, Bolt, Nut, No ClassName, Screw. -----------
----Only returns: Parts, Handle, Bolt, Nut.-----
========================================================================================
<xsl:if test="$interim/A intersect $interim/B">
   <intersect>intersect</intersect>
<xsl:message>Results=<xsl:value-of select="$interim/A intersect $interim/B"/></xsl:message>
</xsl:if>
---Doesnt enter if statement. Actually I want results: Handle, Bolt -----

_----------------------------------------------------------------------------------------------------------------------------------

A sample of the input file is below:

<Parts>
   <A>
    <Class id="123" type="none">Parts</Class>
    <Value id="345" type="CODED_TEXT">Handle</Value>
    <Value id="456" type="CODED_TEXT">Bolt</Value>
    <Value id="567" type="CODED_TEXT">Nut</Value>
   </A>
   <B>
    <Class id="none" type="Property">No ClassName</Class>
    <Value id="234" type="Property">hasProperty Bolt</Value>
    <Value id="789" type="Property">hasLocation Handle</Value>
    <Value id="901" type="Property">hasLocation Screw</Value>
   </B>
</Parts>

Expected results:

Handle, Bolt

Could someone please tell me what Im doing wrong. I read the XSLT2 book and all but cant understand what the error might be.

Thanks
Rahil

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