xsl-list
[Top] [All Lists]

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

2005-07-07 16:13:25




Hi David Carlisle and Wendel Piez,

THANK YOU SO MUCH for trying to help me... You are about to save my day!!! I 
have been working for
11 hours now and I haven't made any real progress :-(...before your posts - it 
has become much
clearer now - I still cannot make it work.

David Carlisle, you said I didn't post enough information. I thought it would 
be to complex and
confusing. Below I have copy'n pasted more...

What I want to do is:

take the adress codes in the:
<Report>
  <HerdCollection>
    <HerdStructure>
      <CHRstructure>
        <OwnerInfoStructure>
          <ForwardingAddressStructure>
           <xkom:AddressSpecific>


and use these values as keys and find the corresponding values in:

XIreport xmlns="http://rep.oio.dk/glrchr.dk/eih/xml/schemas/2005/03/01/";>
  <XIaddressCollection>
   <XIaddressStructure>
     <xkom:AddressSpecific>

and get the

<XIreport xmlns="http://rep.oio.dk/glrchr.dk/eih/xml/schemas/2005/03/01/";>
  <XIaddressCollection>
   <XIaddressStructure>
     <XIaddressSpecificLabelStructure>

back so that I can output them with XSL-FO


I hope this makes sense to you, and you still like to give it a try... :-)





XSL-FILE:
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
xmlns:dkcc2="
http://rep.oio.dk/ebxml/xml/schemas/dkcc/2003/02/13/";  xmlns:dkcc="
http://rep.oio.dk/ebxml/xml/schemas/dkcc/2005/03/15/"; xmlns:xkom="
http://rep.oio.dk/xkom.dk/xml/schemas/2005/03/15/";  xmlns:fh="
http://rep.oio.dk/glrchr.dk/feedhygiene/xml/schemas/2005/03/01/"; xmlns:itst="
http://rep.oio.dk/itst.dk/xml/schemas/2005/01/10/"; xmlns:gr="
http://rep.oio.dk/glrchr.dk/goedningsregnskab/xml/schemas/2005/03/01/"; 
xmlns:chr="
http://rep.oio.dk/glrchr.dk/chr/xml/schemas/2005/03/01/"; xmlns:cvr="
http://rep.oio.dk/cvr.dk/xml/schemas/2005/03/22/"; xmlns:cpr="
http://rep.oio.dk/cpr.dk/xml/schemas/core/2005/03/18/"; xmlns:glr="
http://rep.oio.dk/glrchr.dk/glr/xml/schemas/2005/03/01/"; xmlns:eih="
http://rep.oio.dk/glrchr.dk/eih/xml/schemas/2005/03/01/"; 
xmlns:fo="http://www.w3.org/1999/XSL/Format
" exclude-result-prefixes="fo">
      <xsl:output method="xml" version="1.0" omit-xml-declaration="no" 
indent="yes"/>
      <!-- -->
      <xsl:key name="ForwardingAddressStreetName" match="dkcc:StreetName" use="
concat(AddressSpecific/MunicipalityCode,':',AddressSpecific/StreetCode,':',AddressSpecific/StreetBuildingIdentifier)
" />
      <xsl:key name="ForwardingAddressPostCodeIdentifier" 
match="dkcc:PostCodeIdentifier" use="
../../xkom:AddressSpecific/cpr:MunicipalityCode and 
../../xkom:AddressSpecific/cpr:StreetCode and
../../xkom:AddressSpecific/dkcc2:StreetBuildingIdentifier" />
      <xsl:key name="ForwardingAddressDistrictName" match="dkcc:DistrictName" 
use="
../../xkom:AddressSpecific/cpr:MunicipalityCode and 
../../xkom:AddressSpecific/cpr:StreetCode and
../../xkom:AddressSpecific/dkcc2:StreetBuildingIdentifier" />
      <xsl:key name="ForwardingAddressFloorIdentifier" 
match="dkcc2:FloorIdentifier" use="
../../xkom:AddressSpecific/cpr:MunicipalityCode and 
../../xkom:AddressSpecific/cpr:StreetCode and
../../xkom:AddressSpecific/dkcc2:StreetBuildingIdentifier"/>
      <xsl:key name="ForwardingAddressSuiteIdentifier" 
match="dkcc2:SuiteIdentifier" use="
../../xkom:AddressSpecific/cpr:MunicipalityCode and 
../../xkom:AddressSpecific/cpr:StreetCode and
../../xkom:AddressSpecific/dkcc2:StreetBuildingIdentifier"/>




      <xsl:template match="eih:Report">

      [xsl-fo information goes here...]

      [xsl-fo table is created, here and in a cell there is:
                  <xsl:apply-templates 
select="eih:HerdCollection/eih:HerdStructure/eih:CHRstructure
"/>
      </xsl:template>



      <xsl:template 
match="eih:HerdCollection/eih:HerdStructure/eih:CHRstructure">

                              <xsl:value-of 
select="key('ForwardingAddressStreetName',
eih:OwnerInfoStructure/eih:ForwardingAddressStructure/xkom:AddressSpecific/cpr:MunicipalityCode
 and
eih:OwnerInfoStructure/eih:ForwardingAddressStructure/xkom:AddressSpecific/cpr:StreetCode
 and
eih:OwnerInfoStructure/eih:ForwardingAddressStructure/xkom:AddressSpecific/dkcc2:StreetBuildingIdentifier)
"/>
                              <xsl:text> </xsl:text>
                              <xsl:value-of select="
eih:OwnerInfoStructure/eih:ForwardingAddressStructure/dkcc:DistrictSubdivisionIdentifier"/>
                        </fo:block>
                        <fo:block>
                              <xsl:value-of 
select="key('ForwardingAddressPostCodeIdentifier',
eih:OwnerInfoStructure/eih:ForwardingAddressStructure/xkom:AddressSpecific/cpr:MunicipalityCode
 and
eih:OwnerInfoStructure/eih:ForwardingAddressStructure/xkom:AddressSpecific/cpr:StreetCode
 and
eih:OwnerInfoStructure/eih:ForwardingAddressStructure/xkom:AddressSpecific/dkcc2:StreetBuildingIdentifier)
"/>
                              <xsl:text> </xsl:text>
                              <xsl:value-of 
select="key('ForwardingAddressDistrictName',
eih:OwnerInfoStructure/eih:ForwardingAddressStructure/xkom:AddressSpecific/cpr:MunicipalityCode
 and
eih:OwnerInfoStructure/eih:ForwardingAddressStructure/xkom:AddressSpecific/cpr:StreetCode
 and
eih:OwnerInfoStructure/eih:ForwardingAddressStructure/xkom:AddressSpecific/dkcc2:StreetBuildingIdentifier)
"/>

      </xsl:template>






XML-FILE:

<eih  xmlns:cpr="http://rep.oio.dk/cpr.dk/xml/schemas/core/2005/03/18/";  
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance";  xmlns:xi="
http://eih.glrchr.dk/xml/schemas/xi/2005/05/31/";  xmlns:chr="
http://rep.oio.dk/glrchr.dk/chr/xml/schemas/2005/03/01/";  xmlns:xkom="
http://rep.oio.dk/xkom.dk/xml/schemas/2005/03/15/";  xmlns:dkcc="
http://rep.oio.dk/ebxml/xml/schemas/dkcc/2005/03/15/";  xmlns:cvr="
http://rep.oio.dk/cvr.dk/xml/schemas/2005/03/22/";  xmlns:itst="
http://rep.oio.dk/itst.dk/xml/schemas/2005/01/10/";  xmlns:fh="
http://rep.oio.dk/glrchr.dk/feedhygiene/xml/schemas/2005/03/01/";  xmlns:gr="
http://rep.oio.dk/glrchr.dk/goedningsregnskab/xml/schemas/2005/03/01/";  
xmlns:dkcc2="
http://rep.oio.dk/ebxml/xml/schemas/dkcc/2003/02/13/";  xmlns:glr="
http://rep.oio.dk/glrchr.dk/glr/xml/schemas/2005/03/01/"; ><!--Sample XML file 
generated by XMLSpy
v2005 sp1 U (http://www.xmlspy.com)-->
<Report xmlns="http://rep.oio.dk/glrchr.dk/eih/xml/schemas/2005/03/01/"; 
xmlns:glr="
http://rep.oio.dk/glrchr.dk/glr/xml/schemas/2005/03/01/"; xmlns:gr="
http://rep.oio.dk/glrchr.dk/goedningsregnskab/xml/schemas/2005/03/01/"; 
xmlns:cvr="
http://rep.oio.dk/cvr.dk/xml/schemas/2005/03/22/"; xmlns:cpr="
http://rep.oio.dk/cpr.dk/xml/schemas/core/2005/03/18/"; xmlns:dkcc2="
http://rep.oio.dk/ebxml/xml/schemas/dkcc/2003/02/13/"; xmlns:dkcc="
http://rep.oio.dk/ebxml/xml/schemas/dkcc/2005/03/15/"; xmlns:itst="
http://rep.oio.dk/itst.dk/xml/schemas/2005/01/10/"; xmlns:chr="
http://rep.oio.dk/glrchr.dk/chr/xml/schemas/2005/03/01/"; xmlns:fh="
http://rep.oio.dk/glrchr.dk/feedhygiene/xml/schemas/2005/03/01/"; xmlns:xkom="
http://rep.oio.dk/xkom.dk/xml/schemas/2005/03/15/"; xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="
http://rep.oio.dk/glrchr.dk/eih/xml/schemas/2005/03/01/ 
D:\projects\eih\oio\EIH_Report.xsd">
  <HerdCollection>
    <HerdStructure>
      <CHRstructure>
        <OwnerInfoStructure>
          <ForwardingAddressStructure>
           <xkom:AddressSpecific>
             <cpr:MunicipalityCode>0750</cpr:MunicipalityCode>
             <cpr:StreetCode>3270</cpr:StreetCode>
             
<dkcc2:StreetBuildingIdentifier>256</dkcc2:StreetBuildingIdentifier>
             <dkcc2:FloorIdentifier>3</dkcc2:FloorIdentifier>
             <dkcc2:SuiteIdentifier>2</dkcc2:SuiteIdentifier>
           </xkom:AddressSpecific>
         </ForwardingAddressStructure>
        </OwnerInfoStructure>
      </CHRstructure>
    </HerdStructure>
  <HerdCollection>
      ........more elements left out ....
  </Report>
<XIreport xmlns="http://rep.oio.dk/glrchr.dk/eih/xml/schemas/2005/03/01/";>
  <XIaddressCollection>
   <XIaddressStructure>
     <xkom:AddressSpecific>
             <cpr:MunicipalityCode>0750</cpr:MunicipalityCode>
             <cpr:StreetCode>3270</cpr:StreetCode>
             
<dkcc2:StreetBuildingIdentifier>256</dkcc2:StreetBuildingIdentifier>
             <dkcc2:FloorIdentifier>3</dkcc2:FloorIdentifier>
             <dkcc2:SuiteIdentifier>2</dkcc2:SuiteIdentifier>
     </xkom:AddressSpecific>
     <XIaddressSpecificLabelStructure>
       <dkcc:StreetName>paradisæblevej 5</dkcc:StreetName>
       <dkcc:PostCodeIdentifier>9999</dkcc:PostCodeIdentifier>
       <dkcc:DistrictName>skagen</dkcc:DistrictName>
     </XIaddressSpecificLabelStructure>
   </XIaddressStructure>
   <XIaddressStructure>
     <xkom:AddressSpecific>
            <cpr:MunicipalityCode>0840</cpr:MunicipalityCode>
            <cpr:StreetCode>2160</cpr:StreetCode>
            <dkcc2:StreetBuildingIdentifier>135</dkcc2:StreetBuildingIdentifier>
            <dkcc2:FloorIdentifier>2</dkcc2:FloorIdentifier>
            <dkcc2:SuiteIdentifier>TV</dkcc2:SuiteIdentifier>
     </xkom:AddressSpecific>
     <XIaddressSpecificLabelStructure>
       <dkcc:StreetName>heimdalsgade 20</dkcc:StreetName>
       <dkcc:PostCodeIdentifier>9000</dkcc:PostCodeIdentifier>
       <dkcc:DistrictName>aalborg</dkcc:DistrictName>
     </XIaddressSpecificLabelStructure>
   </XIaddressStructure>
 </XIaddressCollection>
</XIreport>
</eih>


best regards,
Christian


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