Re: [xsl] multiple paths in the "use" in key....I'm getting desperate - please help

Subject: Re: [xsl] multiple paths in the "use" in key....I'm getting desperate - please help
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 07 Jul 2005 17:58:41 -0400
Christian,

In XSLT, "and" is a Boolean operator, returning "true" or "false" depending
on the values returned by the operands, when cast to Boolean. This isn't
going to be very useful for defining keys, most of the time.

What you are looking for is probably the "|" operator, which performs a
union of two node-sets. So "blue | green" is the set of all "blue" element
children of the context with all "green" element children.

These are commonly confused because "|" often translates colloquially as
"or" or "and", as in match="blue|green", which matches blue elements, and
also matches green elements, since the elements it matches are all members
of the union set "blue|green" (blue and green children of something). So we
say it "matches blue or green", which is not at all the same thing as XPath
"blue or green", which returns true if one of "blue" or "green" tests true.
Similarly, select="blue|green" selects all the blue children and all the
green children, in a single set.

I hope this helps,
Wendell

At 05:52 PM 7/7/2005, you wrote:
Im getting desperate: I've been fighting this problem for 10 hours now....

And I'm sure the solution is quite simple.

I want to take the address codes in AddressSpecific: (municipalitycode,
streetcode,
streetbuildingIdentifier)
and look them up in the XIaddressSpecific element AND RETURN THE CORRECT
XIaddressSpecificLabelStructure

How do I do that?

I have been trying using keys, with multiple paths in the "use":

      <xsl:key name="ForwardingAddressPostCodeIdentifier"
match="PostCodeIdentifier" use="
../../AddressSpecific/cpr:MunicipalityCode and
../../AddressSpecific/cpr:StreetCode and
../../AddressSpecific/StreetBuildingIdentifier" />
      <xsl:key name="ForwardingAddressDistrictName" match="DistrictName"
use="
../../AddressSpecific/cpr:MunicipalityCode and
../../AddressSpecific/cpr:StreetCode and
../../AddressSpecific/dkcc2:StreetBuildingIdentifier" />
      <xsl:key name="ForwardingAddressFloorIdentifier"
match="FloorIdentifier" use="
../../AddressSpecific/cpr:MunicipalityCode and
../../AddressSpecific/cpr:StreetCode and
../../AddressSpecific/StreetBuildingIdentifier"/>
      <xsl:key name="ForwardingAddressSuiteIdentifier"
match="SuiteIdentifier" use="
../../AddressSpecific/cpr:MunicipalityCode and
../../AddressSpecific/cpr:StreetCode and
../../AddressSpecific/StreetBuildingIdentifier"/>


but the "and" between the paths in the "use" doesn't seem to work. PLEASE HELP ME! I'm going soon nuts

on beforehand thanx

          <ForwardingAddressStructure>
             <AddressSpecific>
                        <MunicipalityCode>0840</MunicipalityCode>
                        <StreetCode>3270</StreetCode>

<StreetBuildingIdentifier>135</StreetBuildingIdentifier>
            </AddressSpecific>
         </ForwardingAddressStructure>

  <XIaddressCollection>
   <XIaddressStructure>
     <xkom:AddressSpecific>
             <MunicipalityCode>0750</MunicipalityCode>
             <StreetCode>3270</StreetCode>
             <StreetBuildingIdentifier>256</StreetBuildingIdentifier>
             <FloorIdentifier>3</FloorIdentifier>
             <SuiteIdentifier>MF</SuiteIdentifier>
     </AddressSpecific>
     <XIaddressSpecificLabelStructure>
             <StreetName>paradisfblevej 5</StreetName>
                  <PostCodeIdentifier>9999</PostCodeIdentifier>
                  <DistrictName>skagen</DistrictName>
     </XIaddressSpecificLabelStructure>
   </XIaddressStructure>
   <XIaddressStructure>
     <AddressSpecific>
            <MunicipalityCode>0840</MunicipalityCode>
            <StreetCode>3270</StreetCode>
            <StreetBuildingIdentifier>135</StreetBuildingIdentifier>
            <FloorIdentifier>2</FloorIdentifier>
            <SuiteIdentifier>TV</SuiteIdentifier>
     </xkom:AddressSpecific>
     <XIaddressSpecificLabelStructure>
                  <StreetName>Danmarksgade 20</StreetName>
                  <PostCodeIdentifier>9000</PostCodeIdentifier>
                  <DistrictName>aalborg</DistrictName>
     </XIaddressSpecificLabelStructure>
   </XIaddressStructure>
 </XIaddressCollection>



/Best regards,
Christian


======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================

Current Thread