[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

XML Elements Tag (lable) Name is assign at run time

Subject: XML Elements Tag (lable) Name is assign at run time
From: "amit.parikh" <amit.parikh@xxxxxxxxxxxxxxxxx>
Date: Sun, 2 Mar 2003 04:20:43 +0530
amit parikh
I am new to XSl, generating HTML report dynamically from XML & XSL.
A Users Can Select Columns & Can change lable name of Fields ( Table
Headers) , he likes to see on generated report.
 
for example 
    this customer.xml generated with following fields names.
 
<?xml-stylesheet type="text/xsl" href="read.xsl"?>
 <Customers>
  <Customer customercode="11" AccountNo="21221">
   <Name>
    <FirstName></FirstName>
    <LastName></LastName>
   </Name> 
   <DOB>29/04/1976</DOB>
   <PassportNo>A321312</PassportNo>
   <Address>
    <Street></Street>
    <City></City>
    <State></State>
    <Country></Country>
    <Zipcode></Zipcode>
   </Address>
</Customer>
<Customer >
    ....
 </Customer>
</Customers>
   
and corresponding XSL File is like this 
    
<xsl:template match="Customer">
     <tr>
      <td>                    
                            <table border="1" width="100%">
                            
                                <tr>
                                    <td>
                                        <span style="font-weight:bold"> 
                                       CustomerName</span>: 
                                        <span
style="font-size:small"><xsl:value-of select="Name" />
                                         </span>
                                        <br />
                                    </td>
                                </tr>
                                
                                
                               <tr>
                                    <td>
                                        <span style="font-weight:bold">NCSNO
</span> : <xsl:value-of select="DOB" /><br/>
                                    </td>
                                </tr>
                                
                                <tr>
                                    <td>
                                        <span
style="font-weight:bold">PassportNo</span>: <xsl:value-of
select="PassportNo" /></td>
                                </tr>                               
                                
                                <tr>
                                    <td>
                                        <span
style="font-weight:bold">Address</span>:
                                        <xsl:value-of
select="Address/Street" />, <xsl:value-of select="Address/City" /> <br />
                                    </td>
                                </tr>
                                <tr>
                                  <td> <xsl:value-of select="Address/State"
/>, <xsl:value-of select="Address/Country" /></td>
                                </tr>
                                <tr>
      <td><xsl:value-of select="Address/Zipcode" /> </td>
     </tr>                                                          
                                 
                            </table>
</xsl:template> 

 
Now when users change lables of fields
 for e.g  
     DOB to DateOfBirth .
    or
    ZipCode to PostCode.
    
    
     corresponding Customer.xml file, look like this
<?xml-stylesheet type="text/xsl" href="read.xsl"?>
 <Customers>
  <Customer customercode="11" AccountNo="21221">
   <Name>
    <FirstName></FirstName>
    <LastName></LastName>
   </Name> 
<!-- change Tag From DOB to DateOfBirth-->
   <DateOfBirth>29/04/1976</DOB>                

   <PassportNo>A321312</PassportNo>
   <Address>
    <Street></Street>
    <City></City>
    <State></State>
    <Country></Country>
<!-- change tag from ZipCode to PostCode -->
    <PostCode></PostCode>
   </Address>
</Customer>
<Customer >
    ....
 </Customer>
</Customers>
 
 
is there any solution which can solve problem with out rewriting XSL
Template again?? or 
any other better way, to tackle this Problem????
 
 
 
 

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.