xsl-list
[Top] [All Lists]

RE: [xsl] Difference between <when>x</when> and <when><text>x</text></when>

2010-03-21 02:30:26
Hermann,

thanks a lot for this tip!

In fact you might ask yourself why I need it. The reason is: Actually I had 
<when>x</when>, but Eclipse (even the latest one) reformats it by instering 
breaks when using "Source > Format"...

Thanks!
Markus

-----Original Message-----
From: Hermann Stamm-Wilbrandt [mailto:STAMMW(_at_)de(_dot_)ibm(_dot_)com]
Sent: Samstag, 20. März 2010 16:22
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Difference between <when>x</when> and
<when><text>x</text></when>

Markus,

if yo want to remove the spaces for all <when> and <otherwise> entries
you
can
do this by having the complete <choose> inside a <xsl:variable> and
then
call
normalize-space() once afterwards:

<xsl:variable name="v">
  <xsl:choose>
    <xsl:when test="sometest1">
      x1
    </xsl:when>
    <xsl:when test="sometest2">
      x2
    </xsl:when>
    ...
    <xsl:when test="sometestn">
      xn
    </xsl:when>
    <xsl:otherwise test="sometest">
      x
    </xsl:otherwise>
  </xsl:choose>
</xsl:variable>

<xsl:value-of select="normalize-space($v)"/>


Mit besten Gruessen / Best wishes,

Hermann Stamm-Wilbrandt
Developer, XML Compiler, L3
WebSphere DataPower SOA Appliances
----------------------------------------------------------------------
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschaeftsfuehrung: Dirk Wittkopp
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294



             "Markus Karg"
             <karg(_at_)quipsy(_dot_)de>

To
             03/19/2010 08:37          <xsl-
list(_at_)lists(_dot_)mulberrytech(_dot_)com>
             AM
cc


Subject
             Please respond to         RE: [xsl] Difference between
             xsl-list(_at_)lists(_dot_)mu         <when>x</when> and
              lberrytech.com           <when><text>x</text></when>










Markus Karg wrote:

But actually I meant: Is there a way how I can tell this *once* at
the
<choose> or the <stylesheet> level, instead of rewriting all my
<when>s?

No, I don't think so, there is no
   xml:space="normalize"
or similar value defined that could achieve that.

Anyways, thanks a lot! :-)
Markus

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>