This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Converting a SQL XML Resultset using XSL...
- From: "SANSONE, AARON M [Non-Pharmacia/1000]" <aaron dot m dot sansone at monsanto dot com>
- To: "'XSL-List at lists dot mulberrytech dot com'" <XSL-List at lists dot mulberrytech dot com>
- Date: Thu, 28 Feb 2002 11:35:39 -0600
- Subject: [xsl] Converting a SQL XML Resultset using XSL...
- Reply-to: xsl-list at lists dot mulberrytech dot com
We are trying to convert a SQL Result set that is in XML to a business layer
XML Format. We are having trouble trying to get the correct Stylesheet to
generate the desired result. We have a kludge of for-each loops and xsl
keys that I am reluctant to show you here (fear of confusion). This is a
tabular view of a sinpet of what the SQL Query returns:
id display_name tag_name tmp_name score
253241 Test1 XXX15 C 1
253241 Test1 XXX15 T 0
253241 Test1 XXX55 G 1
253241 Test1 XXX55 T 0
...
253242 Test2 XXX15 C 4
253242 Test2 XXX15 T 3
Here is a snipet of our XML Result set (based on the above query results):
<?xml version="1.0"?>
<page>
<rowset name="scores">
<row>
<id>253241</id>
<display_name>Test1</display_name>
<tag_name>XXX15</tag_name>
<tmp_name>C</tmp_name>
<score>1</score>
</row>
<row>
<id>253241</id>
<display_name>Test1</display_name>
<tag_name>XXX15</tag_name>
<tmp_name>T</tmp_name>
<score>0</score>
</row>
<row>
<id>253241</id>
<display_name>Test1</display_name>
<tag_name>XXX55</tag_name>
<tmp_name>G</tmp_name>
<score>1</score>
</row>
<row>
<id>253241</id>
<display_name>Test1</display_name>
<tag_name>XXX55</tag_name>
<tmp_name>T</tmp_name>
<score>0</score>
</row>
...
<row>
<id>253242</id>
<display_name>Test2</display_name>
<tag_name>XXX15</tag_name>
<tmp_name>C</tmp_name>
<score>4</score>
</row>
<row>
<id>253242</id>
<display_name>Test2</display_name>
<tag_name>XXX15</tag_name>
<tmp_name>T</tmp_name>
<score>3</score>
</row>
</rowset>
</page>
After applying the stylesheet we would like the following result:
<individual id="253241" name="Test1">
<tag name="XXX15">
<tmp name="C" score="1"/>
<tmp name="T" score="0"/>
</tag>
<tag name="XXX55">
<tmp name="G" score="1"/>
<tmp name="T" score="0"/>
</tag>
</individual>
...
<individual id="253242" name="Test2">
<tag name="XXX15">
<tmp name="C" score="4"/>
<tmp name="T" score="3"/>
</tag>
</individual>
Can anyone offer some assistance? If you really want our current (non
working) xsl I could post that...
Thanks,
Aaron
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list