This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

White spaces in xsl:text


Hi I'm Yolanda and I'm new in XSL then my knowledge is poor.

I want insert several white-spaces in a xsl:text and I can't because xsl stripped the white-spaces. I put the pag preserve-space but I can't get it works.

Can anyone help me?

I send you my xsl example, it's a style-sheet of one WAP Phone.

Thanks in advance.

Yolanda.
 

XSL Style-sheet
 

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
   <xsl:preserve-space elements="SimpleRow SimpleTableHeader SimpleCol"/>

   <!--
| The Result
+ -->
   <xsl:template match="ServiceRequest">
      <xsl:apply-templates select="//Result"></xsl:apply-templates>
   </xsl:template>

   <!--
| The SimpleResult
+-->
   <xsl:template match="SimpleResult">
      <wml>
         <head>
            <meta http-equiv="Cache-Control" content="max-age=16"></meta>
         </head>
         <template>
         <do type="prev" label="Atras">
              <prev></prev>
         </do>
         <do type="" label="WapMovistar">
             <go href="___REQUEST_NAME__?___SESSION__"></go>
         </do>
         </template>

         <xsl:choose>
            <xsl:when test="boolean(@title) and string-length(@title) > 0 and boolean(@onenterbackward)">
               <card title="{@title}" onenterbackward="{@onenterbackward}">
                  <xsl:apply-templates></xsl:apply-templates>
               </card>
            </xsl:when>
            <xsl:otherwise>
               <xsl:choose>
                  <xsl:when test="boolean(@title) and string-length(@title) > 0">
                     <card title="{@title}">
                        <xsl:apply-templates></xsl:apply-templates>
                     </card>
                  </xsl:when>
                  <xsl:otherwise>
                     <card title="">
                        <xsl:apply-templates></xsl:apply-templates>
                     </card>
                  </xsl:otherwise>
               </xsl:choose>
            </xsl:otherwise>
         </xsl:choose>
      </wml>
   </xsl:template>

   <!--
| The Container, only one expected per result
+-->
   <xsl:template match="SimpleContainer">
      <xsl:apply-templates></xsl:apply-templates>
   </xsl:template>

   <!--
| The SimpleText Mapping
| Note: The WML spec recommends the usage of the "strong" tag.
+-->
   <xsl:template match="SimpleText">
      <do type="" label="Volver">
         <xsl:variable name="volver">
            <xsl:value-of select="SimpleMenuItem/@target"></xsl:value-of>
         </xsl:variable>
         <go href="{$volver}"></go>
      </do>
      <p>
         <xsl:apply-templates></xsl:apply-templates>
      </p>
   </xsl:template>

   <!--
|    The Text Item Mapping
+-->
   <xsl:template match="SimpleTextItem">
      <xsl:if test="(string-length(@name) != 0)">
         <xsl:value-of select="@name"></xsl:value-of>
         <xsl:text>: </xsl:text>
      </xsl:if>
      <xsl:value-of select="."></xsl:value-of>
      <br></br>
   </xsl:template>

   <!--
| The SimpleForm Mapping
|
+-->
   <xsl:template match="SimpleForm">
      <xsl:variable name="theTarget">
         <xsl:value-of select="@target"></xsl:value-of>
         <xsl:for-each select="SimpleFormItem | SimpleFormSelect">
            <xsl:text>&#38;</xsl:text>
            <xsl:value-of select="@name"></xsl:value-of>
            <xsl:text>=$(</xsl:text>
            <xsl:value-of select="@name"></xsl:value-of>
            <xsl:text>)</xsl:text>
         </xsl:for-each>
      </xsl:variable>
      <p>
          <xsl:apply-templates></xsl:apply-templates>
          <a href="{$theTarget}">Aceptar</a>
      </p>
   </xsl:template>

   <!-- The Form Item Mapping -->
   <xsl:template match="SimpleFormItem">
      <strong>
         <xsl:value-of select="."></xsl:value-of>
      </strong>
      <xsl:choose>
         <xsl:when test="boolean(@format) and string-length(@format) > 0">
            <input type="text" name="{@name}" title="{@title}" format="{@format}"></input>
         </xsl:when>
         <xsl:otherwise>
            <input type="text" name="{@name}" title="{@title}"></input>
         </xsl:otherwise>
      </xsl:choose>
   </xsl:template>

   <!-- The Form Select Mapping -->
   <xsl:template match="SimpleFormSelect">
      <strong>
         <xsl:value-of select="./@title"></xsl:value-of>
      </strong>
      <select name="{@name}" title="{@title}">
         <xsl:apply-templates></xsl:apply-templates>
      </select>
   </xsl:template>

   <!-- The Form Option Mapping -->
   <xsl:template match="SimpleFormOption">
      <option value="{@value}">
         <xsl:value-of select="."></xsl:value-of>
      </option>
   </xsl:template>

   <!--  El menu mapping -->

   <xsl:template match="SimpleMenu">
      <xsl:choose>
         <xsl:when test="boolean(@name) and string-length(@name) > 0">
            <xsl:attribute name="title">
               <xsl:value-of select="@name"></xsl:value-of>
            </xsl:attribute>
         </xsl:when>
      </xsl:choose>
      <p>
         <xsl:apply-templates></xsl:apply-templates>
      </p>
   </xsl:template>

   <!-- The Menu Item Mapping -->
   <xsl:template match="SimpleMenuItem">
      <a href="{@target}">
         <xsl:value-of select="."></xsl:value-of>
         <br></br>
      </a>
   </xsl:template>

   <!--
| The Table mapping
| Note: WML requires to know how many columns the table has.
| Set the variable ncol to the number of columns.
+-->
   <xsl:template match="SimpleTable">
      <!-- Create the card -->
      <xsl:apply-templates></xsl:apply-templates>
   </xsl:template>

   <!--
| The Table Row or Header
+-->

   <!-- The Table Row or Header -->
   <xsl:template match="SimpleTableHeader">
      <p>
         <xsl:for-each select="./SimpleCol">
            <xsl:text>   </xsl:text>
            <xsl:value-of select="."> </xsl:value-of>
            <xsl:text>   </xsl:text>
         </xsl:for-each>
      </p>
   </xsl:template>

   <xsl:template match="SimpleRow">
      <xsl:variable name="MaxLongitud">0</xsl:variable>
      <xsl:for-each select="./SimpleCol">
         <xsl:variable name="Longitud">
            <xsl:value-of select="number(string-length(.))"></xsl:value-of>
         </xsl:variable>
         <xsl:if test="$Longitud > $MaxLongitud">
            <xsl:variable name="MaxLongitud">
               <xsl:value-of select="$Longitud"></xsl:value-of>
            </xsl:variable>
         </xsl:if>
      </xsl:for-each>
      <p>
         <xsl:for-each select="./SimpleCol">
            <xsl:variable name="Longitud">
               <xsl:value-of select="number(string-length(.))">
               </xsl:value-of>
            </xsl:variable>
            <xsl:text> </xsl:text>
            <xsl:value-of select="."> </xsl:value-of>
            <xsl:if test="not(position()=last())">
               <xsl:variable name="Blancos">
                  <xsl:value-of select="$MaxLongitud - $Longitud"></xsl:value-of>
               </xsl:variable>
               <xsl:for-each test="$Blancos != 0">
                  <xsl:text>   </xsl:text>
                  <xsl:variable name="Blancos">
                     <xsl:value-of select="$MaxLongitud - $Longitud - 1"></xsl:value-of>
                  </xsl:variable>
               </xsl:for-each>
            </xsl:if>
         </xsl:for-each>
      </p>
   </xsl:template>

</xsl:stylesheet>
 

begin:vcard 
n:Garcia Ulla;Yolanda
x-mozilla-html:FALSE
url:www.oracle.es
org:Oracle Iberica<IMG src="http://iberica.es.oracle.com/img_apesp/orc05.gif">;Consulting
adr:;;C/ Navaluenga 1-3;Las Rozas;Madrid;28230;Spain
version:2.1
email;internet:ygarcia@es.oracle.com
title:Senior Consultant
fn:Yolanda G. Ulla
end:vcard

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]