Re: HELP NEEDED !!! IN XSL AND XSL FO

You must specify a string in the call to normalize-space. In your example, 
you should include the current context.
See the XSLT sample below:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:output method="xml" indent="yes" version="1.0" 
omit-xml-declaration="no"/>
 
  <xsl:strip-space elements="*"/>

  <xsl:template match="/">
     <xsl:apply-templates select="* | @* | text()"/>
  </xsl:template>

  <xsl:template match="text()">
    <xsl:copy-of select="normalize-space(.)"/>
  </xsl:template>

  <xsl:template match="* | @*">
    <xsl:copy>
      <xsl:apply-templates/>
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>

It returns:

<?xml version="1.0" encoding="UTF-16" ?> 
<WEB>
 <SITE>
   <BODY>
     <CENTRE>PA TAJ 2322</CENTRE> 
  </BODY>
 </SITE>
 <SITE> 
   <BODY>
     <CENTRE>ACT KRIVE WROKCT</CENTRE> 
   </BODY>
 </SITE>
 <SITE>
   <BODY>
     <CENTRE>PHILLIPPIN BC 12345</CENTRE> 
   </BODY>
 </SITE>
</WEB>

Cheers,

Arnold Schrijver
2organize
The Netherlands





philip meyer <philip_meyer2001@yahoo.co.in>
Sent by: www-xsl-fo-request@w3.org
12/10/2003 01:26 PM

 
        To:     www-xsl-fo@w3.org
        cc: 
        Subject:        HELP NEEDED !!! IN XSL AND XSL FO


Hi,
Below is my xml 
<WEB>
    <SITE>
        <BODY>
            <LEFT><![CDATA[                            PA TAJ 2322         
                          ]]></CENTRE>
        </BODY>
    </SITE>
    <SITE>
     &nbs p;  <BODY>
            <LEFT><![CDATA[                            ACT KRIVE WROKCT    
                                                        ]]></CENTRE>
        </BODY>
    </SITE>
    <SITE>
        <BODY>
            <LEFT><![CDATA[                            PHILLIPPIN   BC 
12345                                                    ]]></CENTRE>
        </BODY>
    </SITE>
</WEB>
i want to remove the spaces which are before the element starting and 
after the element ended.
i used 
1)  <xsl:strip-space elements="*"/> ...i could not able to get the 
required output
2)  <xsl:template match="text()">
    <xsl:value-of select="normalize-space()"/>
    </xsl:template>
    not able to get the required output
 3) also used substring after space and storing it in variable and print 
substring before ....

 please help me...how to get the required output and also what is the 
problem here....i don't want to strip the spaces which were
 between the element content.....

 Expected Output :
PA TAJ 2322
ACT KRIVE WROKCT
PHILLIPPIN            BC 12345

 
Yahoo! India Mobile: Ringtones, Wallpapers, Picture Messages and more. Download now.

Received on Wednesday, 10 December 2003 11:13:00 UTC