RE: [xsl] Extra spaces

Subject: RE: [xsl] Extra spaces
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 16 Nov 2009 00:19:37 -0000
I can't see how the output relates to your stylesheet code. Your stylesheet
is producing XML, but you are showing text with no tags.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay  

> -----Original Message-----
> From: Surana, Swati [mailto:swati.surana@xxxxxxxx] 
> Sent: 15 November 2009 20:51
> To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
> Subject: [xsl] Extra spaces
> 
> 
> Hello,
> I am using XSLT1.0
> 
> I have to get the output in the below format.
> FWD.AED.01M.0                             0.000600          
> 0.000600          0.000600       1311/12/2009 
> 13:13:0001AUTOMATED PROCES
> 
> But with my XSL def I get the following:
> FWD . AED . 1W . 0 000.000050 000.000200 000.000125  
> 1311/14/2009 13:13:0001AUTOMATED PROCES
> 
> 
> I am getting extra spaces between the first part i.e. FWD . 
> AED . 1W . 0
> 
> My xsl looks like:
> 
> ......
> <xsl:template match="row">
>                 <!-- Skip any rows with a zero length Price 
> Date i.e. no price record available -->
>                 <xsl:if test="string-length(PriceDate)!=0">
>                         <!-- TermCrcy  -->
>                         <xsl:variable name="TermCrcy">
>                                 <xsl:choose>
>                                         <xsl:when 
> test="TermCrcy=$VEB">VEF</xsl:when>
>                                         <xsl:when 
> test="TermCrcy=$UYP">UYU</xsl:when>
>                                         <xsl:otherwise>
>                                                 <xsl:value-of 
> select="TermCrcy"/>
>                                         </xsl:otherwise>
>                                 </xsl:choose>
>                         </xsl:variable>
> 
>                         <!-- Ignore spots from Trestel Output 
> curves - they are all in USD output spot curve.-->
>                         <xsl:if 
> test="contains(CrvTag,$DAILY_SPOTS) or (Tenor and 
> Tenor!=$SPOT) or not(Tenor)">
>                                 <row>
>                                 <xsl:if test="Tenor!=$SPOT">
>                                         <xsl:if test="PiTypC=$FXFR">
>                                         
> <forward><xsl:value-of select="$FWD" 
> /></forward><sep><xsl:value-of select="$Separator" /></sep>
>                                         <TermCrcy>
>                                                 <xsl:value-of 
> select="$TermCrcy"/>
>                                         
> </TermCrcy><sep><xsl:value-of select="$Separator" /></sep>
>                                         <Tenor>
>                                                 <xsl:value-of 
> select="Tenor"/>
>                                         
> </Tenor><sep><xsl:value-of select="$Separator" 
> /></sep><extra><xsl:value-of select="$Zero"/></extra>
>                                         <Bid>
>                                                 <xsl:value-of 
> select="format-number(FullPrc1,$num-fmt)"/>
>                                         </Bid>
>                                         <Ask>
>                                                 <xsl:value-of 
> select="format-number(FullPrc2,$num-fmt)"/>
>                                         </Ask>
>                                         <Mid>
>                                                 <xsl:value-of 
> select="format-number(FullPrice,$num-fmt)"/>
>                                         </Mid>
>                                         </xsl:if>
>                                 </xsl:if>
> 
>                                 <xsl:if test="Tenor=$SPOT">
>                                         <xsl:copy-of select="PiTypC"/>
>                                         <xsl:text>.</xsl:text>
>                                         <TermCrcy>
>                                                 <xsl:value-of 
> select="$TermCrcy"/>
>                                         </TermCrcy>
>                                         <Tenor>
>                                                 <xsl:value-of 
> select="Tenor"/>
>                                         </Tenor>
> 
>                                         </xsl:if>
>                                 </row>
>                         </xsl:if>
>                 </xsl:if>
>         </xsl:template>
> .......
> 
> The XML is:
> 
> "<row>"
>                         + "<PiTypC length='4'>"            + 
> @PiTypC                              + "</PiTypC>"
>                         + @MetaString
>                         + "<TenorDate length='10'>"        + 
> convert(varchar(10),@TenorDate,112)  + "</TenorDate>"
>                         + "<DaysBond length='10'>"         + 
> convert(varchar(10),@DaysBond)       + "</DaysBond>"
>                         + "<DaysActual length='10'>"       + 
> convert(varchar(10),@DaysActual)     + "</DaysActual>"
>                         + "<IMMContractBefore length='2'>" + 
> @IMMContractBefore                   + "</IMMContractBefore>"
>                         + "<IMMContractAfter length='2'>"  + 
> @IMMContractAfter                    + "</IMMContractAfter>"
>                         + "<IMMDateBefore length='10'>"    + 
> convert(varchar(10),@IMMDateBefore,112) + "</IMMDateBefore>"
>                         + "<IMMDateAfter length='10'>"    + 
> convert(varchar(10),@IMMDateAfter,112)  + "</IMMDateAfter>"
>                         + "<SpotDate length='10'>"         + 
> convert(varchar(10),@SpotDate,112)   + "</SpotDate>"
>                         + "<Basis length='15'>"            + 
> rtrim(convert(char,@Basis))          + "</Basis>"
>                         + "<CrvTag length='20'>"           + 
> rtrim(@CrvTag)                       + "</CrvTag>"
>                         + "<CrvRefCode length='20'>"       + 
> rtrim(@CurveRefCode)                 + "</CrvRefCode>"
>                         + "<Label length='20'>"            + 
> @Label                               + "</Label>"
>                         + "<RefCode length='20'>"          + 
> @RefCode                             + "</RefCode>"
>                         + "<FiI length='15'>"              + 
> rtrim(convert(char,@FiI))            + "</FiI>"
>                         + "<Cusip length='9'>"             + 
> @Cusip                               + "</Cusip>"
>                         + "<ISIN length='20'>"             + 
> @ISIN                                + "</ISIN>"
>                         + "<Provider length='20'>"         + 
> @Provider                            + "</Provider>"
>                         + "<Feed length='80'>"             + 
> @Feed                                + "</Feed>"
>                         + "<Time length='5'>"              + 
> @Time                                + "</Time>"
>                         + "<SystemDate length='10'>"       + 
> convert(varchar(10),@SystemDate,112) + "</SystemDate>"
>                         + "<LastActivityDateTime>"         + 
> rtrim(@LastActvyDString)             + "</LastActivityDateTime>"
>                         + "<PriceDate length='10'>"        + 
> convert(varchar(10),@PrcD,112)       + "</PriceDate>"
>                         + "<FullPrc1 length='20'>"         + 
> ltrim(str(@Prc1,20,10))              + "</FullPrc1>"
>                         + "<FullPrc2 length='20'>"         + 
> ltrim(str(@Prc2,20,10))              + "</FullPrc2>"
>                         + "<FullPrice length='20'>"        + 
> ltrim(str(@Price,20,10))             + "</FullPrice>"
>                         + "<Prc1 length='10'>"             + 
> ltrim(str(@Prc1,16,6))               + "</Prc1>"
>                         + "<Prc2 length='10'>"             + 
> ltrim(str(@Prc2,16,6))               + "</Prc2>"
>                         + "<Price length='10'>"            + 
> ltrim(str(@Price,16,6))              + "</Price>"
>                         + "<OverrideFlag>"                 + 
> @OverrideFlag                        + "</OverrideFlag>"
>                         + "<PrevPriceDate>"                + 
> convert(varchar(10),@PrevPrcD,112)   + "</PrevPriceDate>"
>                         + "<FullPrevPrc1 length='20'>"     + 
> ltrim(str(@PrevPrc1,20,10))          + "</FullPrevPrc1>"
>                         + "<FullPrevPrc2 length='20'>"     + 
> ltrim(str(@PrevPrc2,20,10))          + "</FullPrevPrc2>"
>                         + "<FullPrevPrice length='20'>"    + 
> ltrim(str(@PrevPrice,20,10))         + "</FullPrevPrice>"
>                         + "<PrevPrc1 length='10'>"         + 
> ltrim(str(@PrevPrc1,16,6))           + "</PrevPrc1>"
>                         + "<PrevPrc2 length='10'>"         + 
> ltrim(str(@PrevPrc2,16,6))           + "</PrevPrc2>"
>                         + "<PrevPrice length='10'>"        + 
> ltrim(str(@PrevPrice,16,6))          + "</PrevPrice>"
>                         + "<PrevOverrideFlag>"             + 
> @PrevOverrideFlag                    + "</PrevOverrideFlag>"
>                         + "</row>"
> 
> 
> Kindly advise.
> 
> Thanks & Regards,
> Swati

Current Thread