Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


xslt and multiple tables

From: "tshad" <tfs@----------.--->
To: 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 




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent