Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries [Thread Prev] >Thread Next - Re: xslt and multiple tables xslt and multiple tablesTo: NULL Date: 1/7/2008 8:51:00 PM
I have an xml file and xslt file that worked fine together until I added
another set of tags (analysis).
<?xml version="1.0"?>
<addresses>
<address>
<tag name="street">One Microsoft Way</tag>
</address>
<address>
<section Comp="1">
<tag name="street">15 Mako Place</tag>
</section>
</address>
<analysis >
<files>
<rulefile>
<version>09282007</version>
<name>March Errors</name>
</rulefile>
</files>
</analysis>
</addresses>
The xslt file is:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="address">
<dataset>
<xsl:apply-templates/>
</dataset>
</xsl:template>
<xsl:template match="tag|section/tag">
<address>
<sectionNumber>
<xsl:value-of select="ancestor::section/@Comp"/>
</sectionNumber>
<name>
<xsl:value-of select="@name"/>
</name>
<value>
<xsl:value-of select="."/>
</value>
</address>
</xsl:template>
</xsl:stylesheet>
But the result file is:
<?xml version="1.0" encoding="IBM437"?>
<dataset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<address><sectionNumber></sectionNumber><name>street</name><flag
xsi:nil="true"></flag><unit xsi:nil="true"></unit><value>One Microsoft
Way</val
ue></address>
<address><sectionNumber>1</sectionNumber><name>street</name><fla
g xsi:nil="true"></flag><unit xsi:nil="true"></unit><value>15 Mako
Place</value>
</address>
09282007
March Errors
</dataset>
Not sure why I have all the blank lines but you will notice that all the
tags after the 2nd "address" are gone.
There are no tags around the "09282007" and "March Errors".
What I am trying to do is set this up so that I will end up with 2 tables in
a dataset that will read this result - an "address" table and an "analysis"
table.
How would I change my xlst file to do this?
Thanks,
Tom
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
