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]
Other format: [Raw text]

Re: OR in test


| (which means set union) can be read as "or" in match patterns,
although your template is far more complicated than needed.

     <xsl:variable name="type">
   	   <xsl:value-of select="@type"/>
          </xsl:variable>

that makes a result tree fragment with a root node a and a text node
it would be simpler to just use
     <xsl:variable name="type" select="@type"/>
or simpler still not to have a variable at all and just use @type
in the following code instead of $type.

              <xsl:element name="input">
                   <xsl:attribute name="name">
                   <xsl:value-of select="@name"/>
                   </xsl:attribute>
                   <xsl:attribute name="type">
                   <xsl:value-of select="@type"/>
                   </xsl:attribute>
                   <xsl:apply-templates/>
                </xsl:element>

can much more simply be written

            <input name="{@name}" type="{@type}">
               <xsl:apply-templates/>
            </input>

Also the code in your when clause and in your otherwise clause is the
same, i assume that that was a cut and paste error and you meant to have
different results in these cases?


But do you need that or at all? Your code only seems to use the
attributes of input and does not depend on which parent it has so you
could use

<xsl:template match="input">

You don't appear to need to list a/input etc at all.


> and what if in html text is written as TEXT(in capitals).

XSLT is case sensitive.
You either need to match on something like INPUT|input or if you want to
support 
<InPuT> then you can use something like
*[translate(name(),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')='INPUT']


David

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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