[xsl] Newbie Q: Style sheet for simple transform

Subject: [xsl] Newbie Q: Style sheet for simple transform
From: Richard Rowell <richard@xxxxxxxxxxxxxxxxx>
Date: 05 Jun 2002 09:49:54 -0500
I recieve a XML file structured like so:
<records>
 <agencies>
  <agency>
   <name>Agency name</name>   
   <description>test data - description of agency here</description>
   <landmarks>landmark information here</landmarks>
   <zips_served>    
    <zip>32215</zip>
    <zip>32202</zip>
   </zips_served>
   ...(other data fields)
   <custom_label1>customlabel1 name</custom_label1>
   <custom_label2>customlabel2 name</custom_label2>
   <custom_label3>label3</custom_label3>
   <custom_label4>label4</custom_label4>
   <custom_label5>label5</custom_label5>
   ...(other date fields)
  </agency>
  ...(more agency records)
 </agencies>
 ...(other types of records go here)
</records>

I would like to transform this file so that the custom_label fields
are contained in a <custom_labels> record like so:
  ...
  <custom_labels>
   <custom_label1>customlabel1 name</custom_label1>
   <custom_label2>customlabel2 name</custom_label2>
   <custom_label3>label3</custom_label3>
   <custom_label4>label4</custom_label4>
   <custom_label5>label5</custom_label5>
  </custom_labels>
  ...

The rest of the file should just "pass through" unchanged.  I'm positive
this is possible using an XSL processor (in my case Xalan), and I'm
fairly sure it will be very simple... But I'm having a hard time
grasping exactly what the style sheet should look like.

TIA
Richard Rowell
richard@xxxxxxxxxxxxxxxxx

Attachment: signature.asc
Description: This is a digitally signed message part

Current Thread