xsl-list
[Top] [All Lists]

[xsl] generating xml from xslt

2008-08-26 10:47:15
Hi:

I have an xslt through which I am generating an XML file.

<root>
        <status>
                <locn>
                        <loc1>
                                <address>
                                        <add1/>
                                        <add2/>
                                        <add3/>
                                </address>
                        </loc1>
                </locn>
        </status>
        <main>
                <para>This is a test only</para>
        </main>
</root>

I need to write an XSLT to generate this XML file. However, the values of add1, 
add2 and add3 are required to be entered at runtime. So I need to generate 
atleast 5 such xml files with different values for add1, add2 and add3. 

How do I do this? I started writing an XSLT for this. Here is what I have 
written so far. This is not complete and accurate so please let me know how to 
achieve this.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output method="xml"/>

 <xsl:template match="@*|node()">
  <xsl:copy>
   <xsl:apply-templates select="@*|node()"/>
  </xsl:copy>
 </xsl:template>

<xsl:template match="/root/status/locn/loc1/address">
<xsl:element name="add1"></xsl:element>
<xsl:element name="add2"></xsl:element>
<xsl:element name="add3"></xsl:element>
</xsl:template>
</xsl:stylesheet>

Thank you




      


--~------------------------------------------------------------------
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>