xsl-list
[Top] [All Lists]

Re: simple xslt question, retrieved data has no xml tags.

2006-01-22 20:38:41





Hi,
     <xsl:apply-templates select="self" />

The above line in your xslt only selects the node for processing and
without a corresponding template to match, it is left to the default
templates to do something and they only output the text value of the nodes.
If you'd like the xml structure add the following to your xslt.

<xsl:template match="self">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>

Hope this helps.

cheers,
prakash




                                                                                
                                                       
                      "Lizet Pena de                                            
                                                       
                      Sola"                    To:      
<xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>                              
                
                      <lizet(_at_)ironsolut         cc:      (bcc: 
omprakash.v/Polaris)                                                     
                      ions.com>                Subject: [xsl] simple xslt 
question, retrieved data has no xml tags.                    
                                                                                
                                                       
                      01/23/2006 08:49                                          
                                                       
                      AM                                                        
                                                       
                      Please respond                                            
                                                       
                      to xsl-list                                               
                                                       
                                                                                
                                                       
                                                                                
                                                       





Hello all,
I need to import data from a 35MB xml file into a sql server database. I'm
trying to cut that file in smaller chunks of data that can be more
manageable.
I'm using .NET framework 1.1 for this. I believe the processor is MSXML
4.0.
I can't figure out what I'm doing wrong but each time I apply an xslt to
the
file I only get the text inside the nodes and I want to preserve the xml
structure of the nodes I select, in order to create smaller xml files.

Here's the code so far:

Here's the xslt file
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:xs="http://www.w3.org/2001/XMLSchema";
xmlns:fn="http://www.w3.org/2005/xpath-functions";
xmlns:xdt="http://www.w3.org/2005/xpath-datatypes";>
       <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"
media-type="xml"/>
       <xsl:template match="//products[equipment/model='MX210']">
            <xsl:apply-templates select="self" />
       </xsl:template>
</xsl:stylesheet>


Dim doc2 As XmlDocument = New XmlDocument
           doc2.Load("DA880data.xml")

           ' Modify the XML file.
           Dim root As XmlElement = doc2.DocumentElement


           ' Create an XPathNavigator to use for the transform.
           Dim nav As XPathNavigator = root.CreateNavigator()

           ' Transform the file.
           Dim xslt As XslTransform = New XslTransform
           xslt.Load("transformdata.xsl")
           Dim writer As XmlTextWriter = New
XmlTextWriter("output.xml", Nothing)
           xslt.Transform(nav, Nothing, writer, Nothing)


Any idea is more than welcome. Thanks a lot for looking into this.

Lizet


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





This e-Mail may contain proprietary and confidential information and is sent 
for the intended recipient(s) only. 
If by an addressing or transmission error this mail has been misdirected to 
you, you are requested to delete this mail immediately.
You are also hereby notified that any use, any form of reproduction, 
dissemination, copying, disclosure, modification,
distribution and/or publication of this e-mail message, contents or its 
attachment other than by its intended recipient/s is strictly prohibited.

Visit Us at http://www.polaris.co.in

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>