[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Match values from XML-file A with values from XML-file

Subject: Match values from XML-file A with values from XML-file B
From: "Sellmer-Brüls, Barbara" <B.Sellmer-Bruels@xxxxxxxxxxx>
Date: Thu, 24 May 2001 18:37:35 +0200
match xml files
Hello,

I have written a lot of stylesheets, BUT
there is a problem I cannot solve without producing a - as I think - too
copious XSL.

I've got 2 XML files:

file A: contains a structured list of codes that shall be used to collect
data from XML file B

example file A:
<class>
	<chapter no="1" heading="Chapter 1">
		<category goc="*" code="SCA1" />
		<category goc="*" code="SCA2"/>
		<category goc="*" code="SCB1"/>
	</chapter>
	
	<chapter no="2" heading="Chapter 2">
		<category goc="*" code="SCC5"/>
		<category goc="*" code="SCB7" />
	</chapter>
</class>

For each chapter I need to collect all products from file B that have a code
matching one of the codes in the current chapter. The result of all products
matched by the miscellanious codes for this chapter shall be sortet, eg. by
their ID.

file B:
<export>

   <product @id="ISBN-1">
      ... more elements ...
      <class>
	<category code="SCA">
		<category code="SCA1" />
		<category code="SCA2"/>
	</category>
	<category code="SCB">
		<category code="SCB9"/>
	</category>
      </class>
   </product>

   <product @id="ISBN-2">
      ... more elements ...
      <class>
	<category code="SCA">
		<category code="SCA9"/>
	</category>
	<category code="SCB">
		<category code="SCB7"/>
	</category>
      </class>
   </product>

   <product @id="ISBN-3">
      ... more elements ...
      <class>
	<category code="SCB">
		<category code="SCB1"/>
		<category code="SCB7"/>
	</category>
      </class>
   </product>

</export>

Idea 1:
The stylesheet operates on file A (codes) and selects products from file B.
Somehow I feel that there must be an elegant solution, but I don't know how
to match n codes from the chapter code list to m codes within each product
od the export file, AND sort the complete result of each chapter  :-( 

Idea 2:
The stylesheet operates on file B (products), where all chapters are defined
and product-templates are matched if there are nodes with the corresponding
codes. I find this alternative quit labourious.

Does anyone have any idea??
Many thanks
Barbara
----
mailto:b.sellmer-bruels@xxxxxxxxxxx


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.