[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: OR in test

Subject: Re: OR in test
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 4 Jul 2002 14:20:39 +0100
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


Current Thread
  • OR in test
    • ashu t - Thu, 4 Jul 2002 08:34:25 -0400 (EDT)
      • Jeni Tennison - Thu, 4 Jul 2002 08:48:17 -0400 (EDT)
      • Michael Kay - Thu, 4 Jul 2002 09:09:05 -0400 (EDT)
      • David Carlisle - Thu, 4 Jul 2002 09:20:55 -0400 (EDT) <=

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.