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

using XSLT to transform to html....

  • To: xml-dev@l...
  • Subject: using XSLT to transform to html....
  • From: Naveen My <perlnaveen@y...>
  • Date: Tue, 15 Jul 2003 08:46:16 -0700 (PDT)
  • In-reply-to: <20030715112411.30071.qmail@w...>

using xslt in tomcat
I am building an XML from resultset and then rendering it to XSL to show as html on browser...

But,when I see on browser....I see xsl tree with all the xml values...
 
I am also attaching my xml and xsl

Please advice..


thanks

naveen

my piece of code...

PrintWriter out= res.getWriter();

XMLOutputter xout = new XMLOutputter(" ", true);
FileWriter writer = new FileWriter("D://Tomcat 4.1/webapps/careercenter/xml/res.xml");
xout.output(doc,writer);
writer.close();


SAXBuilder builder = new SAXBuilder();
Document mydoc = builder.build("D://Tomcat 4.1/webapps/careercenter/xsl/res.xml");

s.close();
conn.close();

Document docResults=null;
try
{
StreamSource stmsrc="new" StreamSource("D://Tomcat 4.1/webapps/careercenter/xsl/viewresume.xsl");
TransformerFactory tFact=TransformerFactory.newInstance();
Transformer transformer = tFact.newTransformer(stmsrc);
JDOMResult jdRes=new JDOMResult();
JDOMSource jdSrc="new" JDOMSource(mydoc);

transformer.transform(jdSrc,jdRes);
docResults=jdRes.getDocument();

xout.setTextNormalize(true);
xout.output(docResults,out);
}


Do you Yahoo!?
http://pa.yahoo.com/*http://rd.yahoo.com/evt=1207/*http://promo.yahoo.com/sbc/ - Now only $29.95 per month!
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">


<xsl:template match ="resume">

<html>

<head>

<title>View Resume</title>
</head>

<body>

 <table border="0" cellpadding="5" cellspacing="5" style="border-collapse: collapse" bordercolor="#111111" width="50%" id="AutoNumber1">
    <tr>
        <td width="109%" height="22" colspan="2">
        <p align="center"><b><font size="5" color="#800000">
        <span style="background-color: #FFFFCC">RESUME</span></font></b></p></td>
        </tr>
    <tr>
        <td width="59%" height="22"><b>JOB TITLE:</b></td>
        <td width="50%"><xsl:value-of select="job_title"/></td>
    </tr>
    <tr>
        <td width="59%" height="22"><b>JOB LEVEL:</b></td>
        <td width="50%"><xsl:value-of select="job_level"/></td>
    </tr>
    <tr>
        <td width="59%" height="21"><b>DESIRED JOB TYPE:</b></td>
        <td width="50%"><xsl:value-of select="job_type"/></td>
    </tr>
    <tr>
        <td width="59%" height="21"><b>DESIRED STATUS:</b></td>
        <td width="50%"><xsl:value-of select="job_status"/></td>
    </tr>
    <tr>
        <td width="59%" height="22"><b>JOB CATEGORY:</b></td>
        <td width="50%"><xsl:value-of select="job_category"/></td>
    </tr>
    <tr>
        <td width="59%" height="22"><b>TARGET STATE:</b></td>
        <td width="50%"><xsl:value-of select="target_state"/></td>
    </tr>
    <tr>
      <td width="50%"></td>
      <td width="50%">;</td>
    </tr>
    <tr>
      <td width="100%" colspan="2"><b>
        <font size="5" color="#800000"><span style="background-color: #FFFFCC">
        EDUCATION &amp; SKILLS </span></font></b></td>
    </tr>
    <tr>
      <td width="50%"></td>
      <td width="50%"></td>
    </tr>
    <tr>
        <td width="59%" height="22"><b>SCHOOL NAME</b></td>
        <td width="50%"><xsl:value-of select="school_name"/></td>
    </tr>
    <tr>
        <td width="59%" height="22"><b>CITY</b></td>
        <td width="50%"><xsl:value-of select="school_city"/></td>
    </tr>
    <tr>
        <td width="59%" height="22"><b>STATE</b></td>
        <td width="50%"><xsl:value-of select="school_state"/></td>
    </tr>
    <tr>
        <td width="59%" height="22"><b>COUNTRY</b></td>
        <td width="50%"><xsl:value-of select="sch_country"/></td>
    </tr>
    <tr>
        <td width="59%" height="22"><b>DEGREE LEVEL</b></td>
        <td width="50%"><xsl:value-of select="degree_level"/></td>
    </tr>
    <tr>
        <td width="59%" height="23"><b>COMPLETION DATE</b></td>
        <td width="50%"><xsl:value-of select="completion_date"/></td>
    </tr>
    <tr>
      <td width="50%"></td>
      <td width="50%"></td>
    </tr>
    <tr>
      <td width="50%"><b>
        <font size="5" color="#800000"><span style="background-color: #FFFFCC">
        SKILLS :</span></font></b></td>
      <td width="50%"></td>
    </tr>
    <tr>
      <td width="50%"></td>
      <td width="50%"></td>
    </tr>
    <tr>
      <td width="50%"><b>SKILL NAME &amp; YEARS OF EXPERIENCE</b></td>
      <td width="50%"><xsl:value-of select="skills"/></td>
    </tr>
    <tr>
      <td width="50%"></td>
      <td width="50%"></td>
    </tr>
     <tr>
      <td width="100%" colspan="2"><b><font size="4" color="#800000">
      <span style="background-color: #FFFFCC">WORK EXPERIENCE</span></font></b></td>
    </tr>
    <tr>
      <td width="50%"></td>
      <td width="50%"></td>
    </tr>
    <tr>
      <td width="50%"><b>COMPANY NAME</b></td>
      <td width="50%"><xsl:value-of select="company_nm"/></td>
    </tr>
    <tr>
      <td width="50%"><b>COMPANY CITY</b></td>
      <td width="50%"><xsl:value-of select="company_city"/>;</td>
    </tr>
    <tr>
      <td width="50%"><b>STATE</b></td>
      <td width="50%"><xsl:value-of select="state"/></td>
    </tr>
    <tr>
      <td width="50%"><b>TITLE</b></td>
      <td width="50%"><xsl:value-of select="title"/></td>
    </tr>
    <tr>
      <td width="50%"><b>START DATE</b></td>
      <td width="50%"><xsl:value-of select="start_date"/></td>
    </tr>
    <tr>
      <td width="50%"><b>END DATE</b></td>
      <td width="50%"><xsl:value-of select="end_date"/></td>
    </tr>
    <tr>
      <td width="50%"><b>WORK DESCRIPTION</b></td>
      <td width="50%"><xsl:value-of select="work_descrip"/></td>
    </tr>
    <tr>
      <td width="50%"></td>
      <td width="50%"></td>
    </tr>
    <tr>
      <td width="100%" colspan="2"><b><font size="4" color="#800000">
      <span style="background-color: #FFFFCC">REFERENCES</span></font></b></td>
    </tr>
    <tr>
      <td width="50%"></td>
      <td width="50%"></td>
    </tr>
    <tr>
      <td width="50%"><b>REFERENCE NAME</b></td>
      <td width="50%"><xsl:value-of select="refe_nm"/></td>
    </tr>
    <tr>
      <td width="50%"><b>REFERENCE TITLE</b></td>
      <td width="50%"><xsl:value-of select="ref_title"/></td>
    </tr>
    <tr>
      <td width="50%"><b>PHONE</b></td>
      <td width="50%"><xsl:value-of select="phone"/></td>
    </tr>
    <tr>
      <td width="50%"><b>EMAIL</b></td>
      <td width="50%"><xsl:value-of select="email"/></td>
    </tr>
    <tr>
      <td width="50%"></td>
      <td width="50%"></td>
    </tr>
    <tr>
      <td width="100%" colspan="2"><b><font size="4" color="#800000">
      <span style="background-color: #FFFFCC">WORK EXPERIENCE</span></font></b></td>
    </tr>
    <tr>
      <td width="50%"></td>
      <td width="50%"></td>
    </tr>
    <tr>
      <td width="50%"><b>COMPANY NAME</b></td>
      <td width="50%"><xsl:value-of select="company_nm1"/></td>
    </tr>
    <tr>
      <td width="50%"><b>COMPANY CITY</b></td>
      <td width="50%"><xsl:value-of select="company_city1"/></td>
    </tr>
    <tr>
      <td width="50%"><b>STATE</b></td>
      <td width="50%"><xsl:value-of select="state1"/></td>
    </tr>
    <tr>
      <td width="50%"><b>TITLE</b></td>
      <td width="50%"><xsl:value-of select="title1"/></td>
    </tr>
    <tr>
      <td width="50%"><b>START DATE</b></td>
      <td width="50%"><xsl:value-of select="start_date1"/></td>
    </tr>
    <tr>
      <td width="50%"><b>END DATE</b></td>
      <td width="50%"><xsl:value-of select="end_date1"/></td>
    </tr>
    <tr>
      <td width="50%"><b>WORK DESCRIPTION</b></td>
      <td width="50%"><xsl:value-of select="work_descrip1"/></td>
    </tr>
    <tr>
      <td width="50%"></td>
      <td width="50%"></td>
    </tr>
    <tr>
      <td width="100%" colspan="2"><b><font size="4" color="#800000">
      <span style="background-color: #FFFFCC">REFERENCES</span></font></b></td>
    </tr>
    <tr>
      <td width="50%"></td>
      <td width="50%"></td>
    </tr>
    <tr>
      <td width="50%"><b>REFERENCE NAME</b></td>
      <td width="50%"><xsl:value-of select="refe_nm1"/></td>
    </tr>
    <tr>
      <td width="50%"><b>REFERENCE TITLE</b></td>
      <td width="50%"><xsl:value-of select="ref_title"/></td>
    </tr>
    <tr>
      <td width="50%"><b>PHONE</b></td>
      <td width="50%"><xsl:value-of select="phone1"/></td>
    </tr>
    <tr>
      <td width="50%"><b>EMAIL</b></td>
      <td width="50%"><xsl:value-of select="email1"/></td>
    </tr>
     <tr>
      <td width="50%"></td>
      <td width="50%"></td>
    </tr>
    <tr>
      <td width="50%"></td>
      <td width="50%"></td>
    </tr>
  </table>


</body>

</html>

</xsl:template>
</xsl:stylesheet>




<?xml version="1.0" encoding="UTF-8"?>
<resume>
 <job_title>DBA</job_title>
 <job_level>1 to 3</job_level>
 <job_type>intern</job_type>
 <job_status>full</job_status>
 <job_category>compu</job_category>
 <target_state>IL</target_state>
 <school_name>Ykte</school_name>
 <school_city>ap</school_city>
 <school_state>ma</school_state>
 <sch_country>IN</sch_country>
 <degree_level>MS</degree_level>
 <completion_date>2002-03-12 00:00:00.0</completion_date>
 <skills>skill</skills>
 <work_experience>
  <company_nm>sql</company_nm>
  <company_city>hy</company_city>
  <state>yu</state>
  <title>dba</title>
  <start_date>2002-06-12 00:00:00.0</start_date>
  <end_date>2003-07-02 00:00:00.0</end_date>
  <work_descrip>this</work_descrip>
  <refe_nm>bn</refe_nm>
  <ref_title>head</ref_title>
  <phone>234</phone>
  <email>emailid</email>
  <company_nm1>dba</company_nm1>
  <company_city1>hy</company_city1>
  <state1>yu</state1>
  <title1>web</title1>
  <start_date1>2002-07-12 00:00:00.0</start_date1>
  <end_date1>2003-08-02 00:00:00.0</end_date1>
  <work_descrip1>this</work_descrip1>
  <refe_nm1>bn</refe_nm1>
  <ref_title1>head</ref_title1>
  <phone1>234</phone1>
  <email1>emailid</email1>
 </work_experience>
</resume>


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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.