Problem displaying XML using XSL

I am new to XML and XSL. I tried the following.My XML string after using a XQuery

Nokia 3D Animation Toolkit
http://nds2.ncsp.nokia.com/download/?asset_id=10243
3D screen saver tools including software and an example animation.
Nokia 3D Animation Toolkit
3D screen saver tools including software and an example animation.
2002-06-12
application/zip
10243
English
Mobile Entertainment Solutions
3D
Entertainment
Nokia Corporation
N3A_Content_Tools.zip
423 kB
10243
Using these tools requires that you have 3D Studio Max (www.descreet.com).
Toolkit
1.1
Final


My XSL to display above XML is

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl = “http://www.w3.org/1999/XSL/Transform” version=“1.0”>
<xsl:output method=“html” omit-xml-declaration = “yes”/>
<xsl:template match="/">




Nokia Content
Syndication Program (NCSP)


<<View all Available Content Lists


View this list as : RDF | RSS 0.91
| RSS 0.92 | RSS 1.0 XML | JavaScript | JavaScript Array















<xsl:value-of select=“M1ADCNOKIA1/RDF/nokiaitem/title”/> - -
<xsl:value-of select=“M1ADCNOKIA1/RDF/nokiaitem/description”/>




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

I do not see the output with the values from the XML.Please help.

Hello there,

I’m not sure about what you’re trying to do, but here comes a corrected XSL :

********************************************
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl=“http://www.w3.org/1999/XSL/Transform” version=“1.0”>
<xsl:output method=“html” omit-xml-declaration=“yes”/>
<xsl:template match="/">







Nokia Content
Syndication Program (NCSP)





xsl:text<</xsl:text>
xsl:text<</xsl:text>View all Available Content Lists



View this list as : RDF | RSS 0.91
| RSS 0.92 | RSS 1.0 XML | JavaScript | JavaScript Array














<xsl:value-of select="/nokiaitem/title"/> - - <xsl:value-of select="/nokiaitem/description"/>




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

A few comments :

. Don’t write ‘<’ characters into your stylesheet output. This is a reserved character.
Instead use entities : < for ‘<’ and > for ‘>’.

. Why have you prefixed your XPath statements with “M1ADCNOKIA1/RDF” ??? There are no such nodes into your XML source. Instead, refer to your nodes with : “/nokiaitem/title/”.

Here you go.

Feel free to ask for more.

Bertrand Martel
Software AG France

Thanks. The xsl worked. I modified the XSL to display multiple items as shown below.I have attached the XML and the error encountered. Please help.

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl=“http://www.w3.org/1999/XSL/Transform” version=“1.0”>
<xsl:output method=“html” omit-xml-declaration=“yes”/>
<xsl:template match="/">







Nokia Content
Syndication Program (NCSP)



View all Available Content Lists



View this list as : RDF | RSS 0.91
| RSS 0.92 | RSS 1.0 XML | JavaScript | JavaScript Array





<xsl:for-each select=“nokiaitem”>




</xsl:for-each>





<xsl:value-of select="/nokiaitem/title"/> - - <xsl:value-of select="/nokiaitem/description"/>




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


The XML is as shown below


Setting Up And Using Bluetooth Hardware With Development Tools v1.1
http://ncsp.forum.nokia.com/download/?asset_id=12109
descrip.
Setting Up And Using Bluetooth Hardware With Development Tools v1.1
This updated document describes how to set up the Bluetooth testing environment for the C++ emulator of Series 60 SDK 2.1 and Series 80 Developer Platform 2.0 SDK.
2004-10-08
application/pdf
12109
English
Bluetooth
Setting_Up_And_Using_Bluetooth_HW_With_Development_Tools_v1_1_en.pdf
944 kB
12109
Document

Nokia 3D Animation Toolkit
http://nds2.ncsp.nokia.com/download/?asset_id=10243
3D screen saver tools including software and an example animation.
Nokia 3D Animation Toolkit
3D screen saver tools including software and an example animation.
2002-06-12
application/zip
10243
English
Mobile Entertainment Solutions
3D
Entertainment
Nokia Corporation
N3A_Content_Tools.zip
423 kB
10243
Using these tools requires that you have 3D Studio Max (www.descreet.com).
Toolkit
1.1
Final


I encounter the following error :

[05/Nov/2004:12:03:37] failure (12132): for host 10.80.90.111 trying to GET /jsp
/taminotest.jsp, service-j2ee reports: StandardWrapperValve[jsp]: WEB2792: Servl
et.service() for servlet jsp threw exception
javax.servlet.ServletException: Illegal character at end of document, <.
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageCon
textImpl.java:536)
at _jsps._jsp._taminotest_jsp._jspService(_taminotest_jsp.java:258)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:908)
at com.iplanet.ias.web.jsp.JspServlet$JspServletWrapper.service(JspServl
et.java:675)
at com.iplanet.ias.web.jsp.JspServlet.serviceJspFile(JspServlet.java:447
)
at com.iplanet.ias.web.jsp.JspServlet.service(JspServlet.java:363)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:908)
at org.apache.catalina.core.StandardWrapperValve.invokeServletService(St
andardWrapperValve.java:771)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:322)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:509)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:509)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:209)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:509)
at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProce
ssor.java:161)
at com.iplanet.ias.web.WebContainer.service(WebContainer.java:580)
----- Root Cause -----
; Line#: 16; Column#: -1
javax.xml.transform.TransformerException: Illegal character at end of document,
<.
at org.apache.xalan.transformer.TransformerImpl.fatalError(TransformerIm
pl.java:739)
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp
l.java:715)
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp
l.java:1129)
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp
l.java:1107)
at _jsps._jsp._taminotest_jsp._jspService(_taminotest_jsp.java:237)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)

Hi

two changes are required:
1. a syntax problem in line 11 - there are two superfluous ‘<’ - should be

View all Available Content Lists


2. wrong path expressions in lines 24/25 - should be
<xsl:value-of select="/nokiaitem/title"/> - -
<xsl:value-of select="/nokiaitem/description"/>

Then everything looks fine :slight_smile:
Uli