index | search | no replies | posting guidelines | help login | register
Index » Products » ASP Report Wizard v2
search this forum:
:: XML Schema ::    show all messagesPost a New Message | Post a Reply
Jul 5 2005, 4:42 PM
 Re: XML SchemaPost a Reply
 whichman

View this author's profile Send this author a private message Visit author's homepage

from: Laurel, MD

What you need is a template because the schema has already been pre-defined by your report's dataset. Save the file below as dataexport.xsl and use it as your XslExportTemplate.

dataexport.xsl
---------------------------------------------------------------------------------------------------
<xsl:stylesheet version = '1.0' xmlns:xsl = 'http://www.w3.org/1999/XSL/Transform'>
    
<xsl:template match = '/'>
        
<xsl:apply-templates />
    
</xsl:template>
    
<xsl:template match = 'table'>
        
<dataset>
            
<xsl:if test = 'count(/table/theader/tr/th) > 0'>
                
<datacolumns>
                    
<xsl:for-each select = 'theader/tr'>
                        
<xsl:for-each select = 'th'>
                            
<element name = '{.}' type = '{@type}' size = '{@size}' />
                        
</xsl:for-each>
                    
</xsl:for-each>
                
</datacolumns>
            
</xsl:if>
            
<datarows>
                
<xsl:for-each select = 'tbody/tr'>
                    
<datarow>
                        
<xsl:for-each select = 'td'>
                            
<xsl:variable name = 'pos' select = 'position()' />
                            
<datacolumn>
                                
<xsl:if test = 'count(/table/theader/tr/th) > 0'>
                                    
<xsl:attribute name = 'name'>
                                        
<xsl:value-of select = 'ancestor::table/theader/tr/th[$pos]/text()' />
                                    
</xsl:attribute>
                                
</xsl:if>
                                
<xsl:value-of select = '.' />
                            
</datacolumn>
                        
</xsl:for-each>
                    
</datarow>
                
</xsl:for-each>
            
</datarows>
        
</dataset>
    
</xsl:template>
</xsl:stylesheet>



-------------------------
Master of the Game
Pages: (1)   [1]

search this forum: