Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   XML (http://www.velocityreviews.com/forums/f32-xml.html)
-   -   XSL & XML newbie: How to get rid of blank lines in output?? (http://www.velocityreviews.com/forums/t168019-xsl-and-xml-newbie-how-to-get-rid-of-blank-lines-in-output.html)

ricky 10-17-2004 01:26 PM

XSL & XML newbie: How to get rid of blank lines in output??
 
Here is my XML file: 'MSR.xml':

<?xml version="1.0" standalone="yes"?>
<MSR>
<Info>
<BT30004>4:44</BT30004>
<LASTISA />
<CM10009>3:33</CM10009>
<ES00014>1:00</ES00014>
<LASTSRDY />
<LASTSRM1 />
<LASTSRM2>24:23 PM Monday</LASTSRM2>
<MVS>KL30030-&gt;KL50001
BT30004
IS00075-&gt;IS60012</MVS>
<SSEC>9:99</SSEC>
<SIVU>4:44</SIVU>
<TNC />
<IPI />
<RPI>3:33 AM</RPI>
<CMHM>6:23 AM</CMHM>
<AutoSys />
</Info>
</MSR>

And here is my XSL file: 'MSR.xsl':

<xsl:stylesheet xmlns:xsl="<http://www.w3.org/1999/XSL/Transform>"
version="1.0">
<xsl:output method="xml" indent="yes" />
<xsl:strip-space elements="MVS AutoSys" />
<xsl:template match="/">
<html>
<head>
<title>Daily Operations Status Report</title>
</head>
<body bgcolor="#f0f0f0"><H1 align="center">Daily Operations Status
Report</H1>
<H2 align="left"><U><font color="#ff0000">Critical Application Cycle
End Times</font></U></H2>

<xsl:for-each select="MSR/Info">

<xsl:choose>
<xsl:when test="(string-length(BT30004) &gt;0) or
(string-length(LASTISA) &gt;0)">
<font color="#0000CC" size="4"><STRONG>Critical Path
Insurance/ISA</STRONG></font>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>

<xsl:if test="string-length(BT30004) &gt;0">
<li><strong><xsl:text>Insurance DataBase ended at:
</xsl:text><xsl:value-of select="BT30004" /></strong></li>
</xsl:if>

<xsl:if test="string-length(LASTISA) &gt;0">
<li><strong><xsl:text>ISA DataBase ended at: </xsl:text><xsl:value-of
select="LASTISA" /></strong></li>
</xsl:if>

<br />
<br />

<xsl:choose>
<xsl:when test="(string-length(SSEC) &gt;0) or (string-length(SIVU)
&gt;0)">
<font color="#0000CC" size="4"><STRONG>Securities</STRONG></font>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>


<xsl:if test="string-length(SSEC) &gt;0">
<li><STRONG><xsl:text>Securities System Extract Cycle (2:30 AM SLA)
ended at: </xsl:text><xsl:value-of select="SSEC" /></STRONG></li>
</xsl:if>

<xsl:if test="string-length(SIVU) &gt;0">
<li><STRONG><xsl:text>Securities Investment Warehouse Update (6 AM
SLA) ended at: </xsl:text><xsl:value-of select="SIVU" /></STRONG></li>
</xsl:if>
<br />
<br />

<xsl:choose>
<xsl:when test="(string-length(CM10009) &gt;0) or
(string-length(ES00014) &gt;0)">
<font color="#0000CC" size="4"><STRONG>Commissions</STRONG></font>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>


<xsl:if test="string-length(CM10009) &gt;0">
<li><STRONG><xsl:text>Daily Commissions ended at:
</xsl:text><xsl:value-of select="CM10009" /></STRONG></li>
</xsl:if>

<xsl:if test="string-length(ES00014) &gt;0">
<li><STRONG><xsl:text>Semi-Monthly Commissions ended at:
</xsl:text><xsl:value-of select="ES00014" /></STRONG></li>
</xsl:if>
<br />
<br />


<xsl:choose>
<xsl:when test="(string-length(LASTSRDY) &gt;0) or
(string-length(LASTSRM1) &gt;0) or (string-length(LASTSRM2) &gt;0)">
<font color="#0000CC" size="4"><STRONG>Sales</STRONG></font>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>

<xsl:if test="string-length(LASTSRDY) &gt;0">
<li><STRONG><xsl:text>Daily Sales Reporting Cycle ended at:
</xsl:text><xsl:value-of select="LASTSRDY" /></STRONG></li>
</xsl:if>

<xsl:if test="string-length(LASTSRM1) &gt;0">
<li><STRONG><xsl:text>MonthEnd Sales Day1 (Running) or (LASTSRM1)
ended at: </xsl:text><xsl:value-of select="LASTSRM1" /></STRONG></li>
</xsl:if>

<xsl:if test="string-length(LASTSRM2) &gt;0">
<li><STRONG><xsl:text>MonthEnd Sales Day2 (Running) or (LASTSRM2)
ended at: </xsl:text><xsl:value-of select="LASTSRM2" /></STRONG></li>
</xsl:if>
<br />
<br />


<xsl:choose>
<xsl:when test="(string-length(TNC) &gt;0) or (string-length(IPI)
&gt;0) or (string-length(RPI) &gt;0) or (string-length(CMHM) &gt;0)">
<font color="#0000CC" size="4"><STRONG>EBIS/TNC</STRONG></font>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>

<li><STRONG><xsl:text>EBIS/TNC Data Mart Load Status:
</xsl:text></STRONG></li>

<xsl:if test="string-length(TNC) &gt;0">
<li><STRONG><xsl:text>TNC/Client Information (7am SLA) ended at:
</xsl:text><xsl:value-of select="TNC" /></STRONG></li>
</xsl:if>

<xsl:if test="string-length(IPI) &gt;0">
<li><STRONG><xsl:text>Investment Product Information (8am SLA) ended
at: </xsl:text><xsl:value-of select="IPI" /></STRONG></li>
</xsl:if>

<xsl:if test="string-length(RPI) &gt;0">
<li><STRONG><xsl:text>Risk Product Information (7am SLA) ended at:
</xsl:text><xsl:value-of select="RPI" /></STRONG></li>
</xsl:if>

<xsl:if test="string-length(CMHM) &gt;0">
<li><STRONG><xsl:text>Contact Management Historical Mart ended at:
</xsl:text><xsl:value-of select="CMHM" /></STRONG></li>
</xsl:if>

<br />
<br />

<xsl:if test="string-length(MVS) &gt;0">
<font color="#0000CC" size="4"><STRONG><U><xsl:text>MVS Jobs
Tabled</xsl:text></U></STRONG></font><pre><xsl:value-of select="MVS"
/></pre>
</xsl:if>

<xsl:if test="string-length(AutoSys) &gt;0">
<font color="#0000CC" size="4"><STRONG><U><xsl:text>AutoSys Jobs
Tabled</xsl:text></U></STRONG></font><pre><xsl:value-of
select="AutoSys" /></pre>
</xsl:if>

</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>


Here is the HTML output after my VB .Net script transforms the the
XML->XSL->MSR.html. As you can see there is 'blank line' between 'MVS
Jobs Tabled' heading and the first line of data 'KL30030->KL50001'.
The same is with 'AutoSys Jobs Tabled' heading and it's first line of
data 'dailyopsfail'. I've tried '<xsl:output method="xml" indent="yes"
/>
<xsl:strip-space elements="MVS AutoSys" />' but the blank lines are
still there. I'm using '<pre>' to preserve the formatting in the 'MVS'
and 'AutoSys' fields.

Daily Operations Status Report
Critical Application Cycle End Times
Critical Path Insurance/ISA
Insurance DataBase ended at: 4:44

Securities
Securities System Extract Cycle (2:30 AM SLA) ended at: 9:99
Securities Investment Warehouse Update (6 AM SLA) ended at: 4:44

Commissions
Daily Commissions ended at: 3:33
Semi-Monthly Commissions ended at: 1:00

Sales
MonthEnd Sales Day2 (Running) or (LASTSRM2) ended at: 24:23 PM Monday

EBIS/TNC
EBIS/TNC Data Mart Load Status:
Risk Product Information (7am SLA) ended at: 3:33 AM
Contact Management Historical Mart ended at: 6:23 AM

MVS Jobs Tabled

KL30030->KL50001
BT30004
IS00075->IS60012


AutoSys Jobs Tabled

dailyopsfail
commissnData



Basically, I have a VB .net app. that users input data into textboxes
except for the MVS and AutoSys these are inputted into RichTextBoxes
to preserve the 'return' character'. Then the app. creates a XML and
formats it against a XSL file and then transforms it into a html page.
I think the script is doing it job ok. But, the XSL file needs to be
looked at.

Any ideas?????

Joris Gillis 10-17-2004 08:28 PM

Re: XSL & XML newbie: How to get rid of blank lines in output??
 
> As you can see there is 'blank line' between 'MVS
> Jobs Tabled' heading and the first line of data 'KL30030->KL50001'.
> The same is with 'AutoSys Jobs Tabled' heading and it's first line of
> data 'dailyopsfail'. I've tried '<xsl:output method="xml" indent="yes"
> />
> <xsl:strip-space elements="MVS AutoSys" />' but the blank lines are
> still there. I'm using '<pre>' to preserve the formatting in the 'MVS'
> and 'AutoSys' fields.


This is simply a html displaying matter.
Use this line in the CSS to strip the 'blank lines' (which do not really
exist).
pre {margin-top:0px}

by the way, more CSS could (and should?) be used in the XSLT:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html" indent="yes" />
<xsl:template match="/">
<html>
<head>
<style type="text/css">
body {background-color:#f0f0f0}
h1 {text-align:center}
h2 {text-align:left;text-decoration:underline;color:red}
h3 {color:#00c;font-size:medium;margin-bottom:0px;margin-top:4ex}
li,h3 {font-weight:bold}
pre {margin-top:0px}
</style>
<title>Daily Operations Status Report</title>
</head>
<body>

<H1>Daily Operations Status Report</H1>
<H2>Critical Application Cycle End Times</H2>
<xsl:apply-templates select="MSR/Info"/>

</body>
</html>
</xsl:template>

<xsl:template match="Info">

<xsl:if test="(BT30004 !='') or (LASTISA !='')">
<h3>Critical Path Insurance/ISA</h3>
<xsl:apply-templates select="BT30004"/>
<xsl:apply-templates select="LASTISA"/>
</xsl:if>

<xsl:if test="(SSEC !='') or (SIVU !='')">
<h3>Securities</h3>
<xsl:apply-templates select="SSEC"/>
<xsl:apply-templates select="SIVU"/>
</xsl:if>

<xsl:if test="(CM10009 !='') or (ES00014 !='')">
<h3>Commissions</h3>
<xsl:apply-templates select="CM10009"/>
<xsl:apply-templates select="ES00014"/>
</xsl:if>

<xsl:if test="(LASTSRDY !='') or (LASTSRM1 !='') or (LASTSRM2 !='')">
<h3>Sales</h3>
<xsl:apply-templates select="LASTSRDY"/>
<xsl:apply-templates select="LASTSRM1"/>
<xsl:apply-templates select="LASTSRM2"/>
</xsl:if>

<xsl:if test="(TNC !='') or (IPI !='') or (RPI !='') or (CMHM !='')">
<h3>EBIS/TNC</h3>
<xsl:apply-templates select="TNC"/>
<xsl:apply-templates select="IPI"/>
<xsl:apply-templates select="RPI"/>
<xsl:apply-templates select="CMHM"/>
</xsl:if>

<xsl:apply-templates select="MVS"/>
<xsl:apply-templates select="AutoSys"/>

</xsl:template>

<xsl:template match="BT30004[. != '']">
<li>Insurance DataBase ended at: <xsl:value-of select="." /></li>
</xsl:template>
<xsl:template match="LASTISA[. != '']">
<li>ISA DataBase ended at: <xsl:value-of select="." /></li>
</xsl:template>
<xsl:template match="SSEC[. != '']">
<li>Securities System Extract Cycle (2:30 AM SLA)
ended at: <xsl:value-of select="." /></li>
</xsl:template>
<xsl:template match="SIVU[. != '']">
<li>Securities Investment Warehouse Update (6 AM
SLA) ended at: <xsl:value-of select="." /></li>
</xsl:template>
<xsl:template match="CM10009[. != '']">
<li>Daily Commissions ended at: <xsl:value-of select="." /></li>
</xsl:template>
<xsl:template match="ES00014[. != '']">
<li>Semi-Monthly Commissions ended at: <xsl:value-of select="." /></li>
</xsl:template>
<xsl:template match="LASTSRDY[. != '']">
<li>Daily Sales Reporting Cycle ended at: <xsl:value-of select="."/></li>
</xsl:template>
<xsl:template match="LASTSRM1[. != '']">
<li>MonthEnd Sales Day1 (Running) or (LASTSRM1) ended at: <xsl:value-of
select="."/></li>
</xsl:template>
<xsl:template match="LASTSRM2[. != '']">
<li>MonthEnd Sales Day2 (Running) or (LASTSRM2) ended at: <xsl:value-of
select="."/></li>
</xsl:template>
<xsl:template match="TNC[. != '']">
<li>TNC/Client Information (7am SLA) ended at: <xsl:value-of
select="."/></li>
</xsl:template>
<xsl:template match="IPI[. != '']">
<li>Investment Product Information (8am SLA) ended at: <xsl:value-of
select="."/></li>
</xsl:template>
<xsl:template match="RPI[. != '']">
<li>Risk Product Information (7am SLA) ended at: <xsl:value-of
select="."/></li>
</xsl:template>
<xsl:template match="CMHM[. != '']">
<li>Contact Management Historical Mart ended at: <xsl:value-of
select="."/></li>
</xsl:template>
<xsl:template match="MVS[. != '']">
<h3>MVS JobsTabled</h3><pre><xsl:value-of select="."/></pre>
</xsl:template>
<xsl:template match="AutoSys[. != '']">
<h3>AutoSys Jobs Tabled</h3><pre><xsl:value-of select="."/></pre>
</xsl:template>

<xsl:template match="*"/>

</xsl:stylesheet>

regards,

--
Joris Gillis (http://www.ticalc.org/cgi-bin/acct-v...i?userid=38041)
Ceterum censeo XML omnibus esse utendum


All times are GMT. The time now is 10:19 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.