Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Tomcat - JSP/Servlet container
Struts - A MVC web framework
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
JSP - A mailing list about Java Server Pages specification and reference
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Subject: Servlet : Session invalidate
Oracle Connection Pooling in 3 2 2
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Subject: Running a Simple JMS Example
Tomcat and webapplication specific java library path
Mapping in workers2 properties
org apache jasper JasperException
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action
   MESSAGE
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
Value attribute of <html:checkbox
url string for connecting jboss to oracle
javax servlet ServletException: BeanUtils populate
5 0 18: Windows XP Pro vs Windows 2000
HTTP Status 404 The requested resource is not available
 
HELP NEEDED IN XSLT

HELP NEEDED IN XSLT

2007-04-27       - By Zeeshan

 Back
Hi every one

I am unable to transform the xml to text using the xslt. the contents of the
files are also pasted below

page.xml
<Event>
<Page>
<DIV StyleClass="top_banner_right1">
<H1 Class="h1_1">This is heading</H1>
<B>(August 31-September 3, 2007)</B>
<BREAK />
<B>Saroba garden lahore</B>
</DIV>
</Page>
</Event>


page.xslt

<xsl:template match="Event/Page/DIV"><xsl:text><![CDATA[<s:div ]]></xsl:text>
<xsl:if test="@(protected)"><xsl:text><![CDATA[StyleClass ="]]></xsl:text><xsl
:value-of select="@(protected)" /><xsl:text><![CDATA[">]]></xsl:text></xsl:if>
<xsl:text><![CDATA[ ]]></xsl:text><xsl:value-of select="."/><xsl:text><![CDATA[]
]></xsl:text></xsl:template>
<xsl:template match="Event/Page/DIV/H1"><xsl:text><![CDATA[<h1>]]></xsl:text>
<xsl:value-of select="."/><xsl:text><![CDATA[</h1>]]></xsl:text></xsl:template>

<xsl:template match="Event/Page/DIV/B"><xsl:text><![CDATA[<B>]]></xsl:text><xsl
:value-of select="."/><xsl:text><![CDATA[</B>]]></xsl:text></xsl:template>

<xsl:template match="Event/Page/DIV/BREAK">

<xsl:text><![CDATA[<br>]]></xsl:text><xsl:value-of select="."/><xsl:text><
!CDATA[</br>]]></xsl:text></xsl:template>



in fact  I am getting following as output

<s:div StyleClass ="top_banner_right1"> This is heading(August 31-September 3,
2007) Saroba garden lahore



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859 (See http://iso-8859.ora-code.com)-1">
<META content="MSHTML 6.00.2900.2180" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>
<DIV><FONT face=Arial size=2>Hi every one</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I am unable to trans</FONT><FONT face=Arial
size=2>form the xml to text using the xslt. </FONT><FONT face=Arial size=2>the
contents of the files are also pasted below</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>page.xml</FONT></DIV>
<DIV><FONT face=Arial size=2>&lt;Event&gt;<BR>&lt;Page&gt;<BR>&lt;DIV
StyleClass="top_banner_right1"&gt;<BR>&lt;H1 Class="h1_1"&gt;This is
heading&lt;/H1&gt;<BR>&lt;B&gt;(August 31-September 3,
2007)&lt;/B&gt;<BR>&lt;BREAK /&gt;<BR>&lt;B&gt;Saroba garden
lahore&lt;/B&gt;<BR>&lt;/DIV&gt;<BR>&lt;/Page&gt;<BR>&lt;/Event&gt;<BR></FONT><
/DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>page.xslt</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><FONT size=2>&lt;xsl:template
match="Event/Page/DIV"&gt;&lt;xsl:text&gt;&lt;![CDATA[&lt;s:div
]]&gt;&lt;/xsl:text&gt;&lt;xsl:if
test="@(protected)"&gt;&lt;xsl:text&gt;&lt;![CDATA[StyleClass
="]]&gt;&lt;/xsl:text&gt;&lt;xsl:value-of select="@(protected)"
/&gt;&lt;xsl:text&gt;&lt;![CDATA["&gt;]]&gt;&lt;/xsl:text&gt;&lt;/xsl:if&gt;&lt
;xsl:text&gt;&lt;![CDATA[
]]&gt;&lt;/xsl:text&gt;&lt;xsl:value-of
select="."/&gt;&lt;xsl:text&gt;&lt;![CDATA[]]&gt;&lt;/xsl:text&gt;&lt;/xsl
:template&gt;</DIV>
<DIV>
<P>&lt;xsl:template
match="Event/Page/DIV/H1"&gt;&lt;xsl:text&gt;&lt;![CDATA[&lt;h1&gt;]]&gt;&lt;
/xsl:text&gt;&lt;xsl:value-of
select="."/&gt;&lt;xsl:text&gt;&lt;![CDATA[&lt;/h1&gt;]]&gt;&lt;/xsl:text&gt;
&lt;/xsl:template&gt;</P>
<P>&lt;xsl:template
match="Event/Page/DIV/B"&gt;&lt;xsl:text&gt;&lt;![CDATA[&lt;B&gt;]]&gt;&lt;/xsl
:text&gt;&lt;xsl:value-of
select="."/&gt;&lt;xsl:text&gt;&lt;![CDATA[&lt;/B&gt;]]&gt;&lt;/xsl:text&gt;&lt
;/xsl:template&gt;</P>
<P>&lt;xsl:template match="Event/Page/DIV/BREAK"&gt;</P>
<P>&lt;xsl:text&gt;&lt;![CDATA[&lt;br&gt;]]&gt;&lt;/xsl:text&gt;&lt;xsl:value
-of
select="."/&gt;&lt;xsl:text&gt;&lt;!CDATA[&lt;/br&gt;]]&gt;&lt;/xsl:text&gt;&lt
;/xsl:template&gt;</P>
<P>&nbsp;</P>
<P>in fact &nbsp;I am getting following as output</P>
<P><FONT face=Arial size=2>&nbsp;&lt;s:div StyleClass
="top_banner_right1"&gt;&nbsp;This is heading(August 31-September 3, 2007)
Saroba garden lahore</FONT></P>
<P>&nbsp;</P></FONT></FONT></DIV></FONT></DIV></BODY></HTML>

__ ____ ____ ____ ____ ____ ____ ____ ____ ____
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.