Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries [Thread Prev] >Thread Next - Re: Text output twice. Once in HTML tags and immediately following html tags Text output twice. Once in HTML tags and immediately following html tagsTo: NULL Date: 3/3/2008 7:12:00 AM Hello,
I am new to XSLT and I am trying to create an XSL stylesheet
that transforms XML to HTML. I am trying to generate a navigable side
menu and the contents of the document. My problem is that text seems
to be printed twice after I use
<pre>
<xsl:value-of select=3D"text()"/>
</pre>
in the content section of my document. The text prints once inside the
HTML tags and immediately following the HTML tags. This happens when
the current node is not a leaf node and has one or more descendants.
I am using MSXSL 4.0 to process my stylesheet. Here is a snippet of my
xml document:
<?xml version=3D"1.0" encoding=3D"utf-8"?>
<Info_Log>
<Application_Logs>
<ALM>SVAL.LOG could not be found
</ALM>
<DMS>
<DMSSDB.LOG>
Date & Time: Mon Jan 14 09:43:06 2008
Release 1.41A Build 032 Oracle 9
Oracle Error Messages:
----------------------
Time and Date: Mon Jan 14 09:43:58 2008
ORA-01403: no data found
rc =3D 1403 in func OFETCH, OFEN
SELECT DISTINCT E.FLD_ID, E.PRECISION, E.DATA_TYP_ID, E.FLD_NM,
E.DESCRIPTION, E.LG_DFORMAT, E.S_DFORMAT, E.LOGICAL_LEN, A.TABLE_NM
FROM COMP_RATE_MUP C, DATELEM E, DATTBL A, DATREC R WHERE C.FILE_ID =3D
7588 AND A.FILE_ID =3D C.FILE_ID AND E.FLD_ID =3D C.RATE_FLD_ID AND
E.FLD_ID =3D R.FLD_ID AND A.FILE_ID =3D R.FILE_ID AND E.REQUIRED !=3D 'S'
ORDER BY E.DESCRIPTION ASC
Time and Date: Mon Jan 14 09:44:33 2008
ORA-01403: no data found
rc =3D 1403 in func OFETCH, OFEN
SELECT DISTINCT E.FLD_ID, E.PRECISION, E.DATA_TYP_ID, E.FLD_NM,
E.DESCRIPTION, E.LG_DFORMAT, E.S_DFORMAT, E.LOGICAL_LEN, A.TABLE_NM
FROM COMP_RATE_MUP C, DATELEM E, DATTBL A, DATREC R WHERE C.FILE_ID =3D
7588 AND A.FILE_ID =3D C.FILE_ID AND E.FLD_ID =3D C.RATE_FLD_ID AND
E.FLD_ID =3D R.FLD_ID AND A.FILE_ID =3D R.FILE_ID AND E.REQUIRED !=3D 'S'
ORDER BY E.DESCRIPTION ASC
</DMSSDB.LOG>ERRORLOG.TXT could not be found
</DMS>
<FTP>
<EVENT.LOG>***********************************************************
IPS-Sendero FTP log started 2007.08.21 08:34:26.541
[2007.08.21 08:35:08.660 ----- IPS-Sendero FTP:ShadowLib ----- Error]
Channel 0xDBD2E8 error detail:
Interface message: Generic Success (0)
Native message: ORA-01017: invalid username/password; logon denied
(1017)
Rec/row: -1 Fld/col: -1 SQL: <N/A>
File=3D.\SChannelDB.cpp, Line=3D752
[2007.08.21 08:35:08.660 ----- IPS-Sendero FTP:FTP GUI ----- Query]
Error: Unable to connect to Database: ORA-01017: invalid username/
password; logon denied !
File=3D.\MainFrm.cpp, Line=3D274
</EVENT.LOG>
<DAOERROR.LOG>***********************************************************
IPS-Sendero Application log started 2007.08.21 08:35:06.782
Dao Layer error: Tue Aug 21 08:35:08 2007
File: .\Svdaomgr.cpp
Line number: 84
ORA-01017: invalid username/password; logon denied
Original SQL code[-1017]:
SQL string not available. See previous
Channel Ptr: 25013fd8.
Module 10003, Failed oci olog() in openConnect().
Dao Layer error: Tue Aug 21 08:35:08 2007
File: .\Svdaomgr.cpp
Line number: 84
ORA-01017: invalid username/password; logon denied
Original SQL code[-1017]:
SQL string not available. See previous
Channel Ptr: 25013fd8.
Module 10003, Failed oci olog() in openConnect().
Tue Aug 21 08:35:11 2007
</DAOERROR.LOG>
</FTP>
</Application_Logs>
</Info_Log>
Here is my stylesheet:
<?xml version=3D"1.0" encoding=3D"utf-8"?>
<xsl:stylesheet version=3D"1.0" xmlns:xsl=3D"http://www.w3.org/1999/XSL/
Transform">
<xsl:output method=3D"html" />
<xsl:template match=3D"/">
<html>
<head>
<meta name=3D"author" content=3D"IPS-Sendero" />
<title>Info.Log</title>
<xsl:element name=3D"link">
<xsl:attribute name=3D"href">Info.css</xsl:attribute>
<xsl:attribute name=3D"rel">stylesheet</xsl:attribute>
<xsl:attribute name=3D"type">text/css</xsl:attribute>
</xsl:element>
<xsl:element name=3D"script">
<xsl:attribute name=3D"src">viewerWebScripts.js</
xsl:attribute>
<xsl:attribute name=3D"type">text/javascript</xsl:attribute>
</xsl:element>
</head>
<body>
<div id=3D"page_container">
<div id=3D"header">
</div>
<div id=3D"side_nav">
<ol>
<xsl:apply-templates mode=3D"sidenav"/>
</ol>
</div>
<div id=3D"content">
<xsl:element name =3D"h1">Info.Log</xsl:element>
<xsl:apply-templates mode=3D"content"/>
</div>
<div id=3D"footer">
=A9 2007 IPS-Sendero.
=A9 2007 Fiserv, Inc.
</div>
</div>
</body>
</html>
</xsl:template>
<!-- This generates the side navigation menu section -->
<xsl:template match=3D"/Info_Log/* " mode=3D"sidenav">
<xsl:element name=3D"li">
<xsl:element name=3D"a">
<xsl:attribute name=3D"href">
#<xsl:value-of select=3D"name()"/>
</xsl:attribute>
<xsl:choose>
<xsl:when test=3D"contains(name(.),'_')">
<xsl:value-of select=3D"substring-before(name(.),'_')"/>
<xsl:text> </xsl:text>
<xsl:value-of select=3D"substring-after(name(.),'_')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select=3D"name(.)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
<!-- Populate the sub menu items if the current node has child
elements -->
<xsl:if test=3D"./*">
<xsl:element name=3D"ol">
<xsl:for-each select=3D"./*">
<xsl:element name =3D"li">
<xsl:attribute name=3D"class">menuitem</xsl:attribute>
<xsl:element name=3D"a">
<xsl:attribute name=3D"href">
#<xsl:value-of select=3D"name(..)"/>~<xsl:value-of
select=3D"name(.)"/>
</xsl:attribute>
<xsl:choose>
<xsl:when test=3D"contains(name(),'_')">
<xsl:value-of select=3D"substring-
before(name(),'_')"/>
<xsl:text> </xsl:text>
<xsl:value-of select=3D"substring-after(name(),'_')"/
>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select=3D"name()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
<!-- End of Anchor Tag-->
</xsl:element>
<!-- End of LI tag -->
</xsl:for-each>
</xsl:element>
<!-- End of OL tag-->
</xsl:if>
</xsl:element>
</xsl:template>
<!-- This generates the Content section -->
<xsl:template match=3D"Info_Log/*" mode=3D"content" >
<xsl:element name =3D"h2">
<xsl:element name=3D"a">
<xsl:attribute name=3D"id">
<xsl:value-of select=3D"name()"/>
</xsl:attribute>
<xsl:choose>
<xsl:when test=3D"contains(name(),'_')">
<xsl:value-of select=3D"substring-before(name(),'_')"/>
<xsl:text> </xsl:text>
<xsl:value-of select=3D"substring-after(name(),'_')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select=3D"name()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</xsl:element>
<xsl:if test=3D"string-length(normalize-space(text()[1])) > 0">
<pre>
<xsl:value-of select =3D"text()"/>
</pre>
</xsl:if>
<xsl:apply-templates mode=3D"content"/>
</xsl:template>
<xsl:template match =3D"Info_Log/*/*" mode=3D"content">
<xsl:element name =3D"h3">
<xsl:element name=3D"a">
<xsl:attribute name=3D"id">
<xsl:value-of select=3D"name(..)"/>~<xsl:value-of
select=3D"name()"/>
</xsl:attribute>
<xsl:choose>
<xsl:when test=3D"contains(name(),'_')">
<xsl:value-of select=3D"substring-before(name(),'_')"/>
<xsl:text> </xsl:text>
<xsl:value-of select=3D"substring-after(name(),'_')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select=3D"name()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</xsl:element>
<!-- If the current node has text print it in the correct format --
>
<xsl:if test=3D"string-length(normalize-space(text()[1])) > 0">
<pre>
<xsl:value-of select =3D"text()"/>
</pre>
</xsl:if>
<xsl:apply-templates mode=3D"content"/>
</xsl:template>
<xsl:template match =3D"Info_Log/*/*/*" mode=3D"content" >
<xsl:element name =3D"h4">
<xsl:choose>
<xsl:when test=3D"contains(name(),'_')">
<xsl:value-of select=3D"substring-before(name(),'_')"/>
<xsl:text> </xsl:text>
<xsl:value-of select=3D"substring-after(name(),'_')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select=3D"name()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
<!-- If the current node has text print it in the correct format --
>
<xsl:if test=3D"string-length(normalize-space(text()[1])) > 0">
<pre>
<xsl:value-of select =3D"text()"/>
</pre>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Is the error due to the way I am using the mode attribute and the
select attribute in my templates? How can I change my stylesheet to
remove the unwanted text immediately following my tags? Any help you
could provide would be greatly appreciated.
Thanks,
Koshin
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
