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

RE: Including some records and excluding others in a

Subject: RE: Including some records and excluding others in a search
From: "Lewis, Russell" <Russell.Lewis@xxxxxxxxxxxxxxxx>
Date: Fri, 29 Feb 2008 09:25:21 -0500
 RE: Including some records and excluding others in a
Sorry for the long, confusing post but here is the same question in a more
simplified version.(Funny the clarity you get from a good night's sleep)

I'm trying to learn how/do two things here:
1) If the user searches for "Data" ($searchtext = "Data") the output should
also include the fourth
  record because Field1 contains "all".
 2) But the output of this same search should also exclude any records where
Field1 contains "info"
  ($searchtext = "info"). You can see by the textsearch template that I have 3
case conversion
  variables that can be used to to include/exclude "All", "all", "ALL",
"Info", "info", or "INFO"

A statement like this includes "all" but I can't figure out how to get it to
also exclude "info"
 <xsl:for-each select="record[*[name() = $searchfield][contains(.,
$ProperText) or contains(., $UCASETEXT) or contains(., $lcasetext) or
../Field1[contains(., 'ALL') or contains(., 'all') or contains(., 'All')]]]">

XML Data

<?xml version="1.0"?>
<data>
  <record>
    <Field1>Data1-1</Field1>
    <Field2>Data1-2</Field2>
    <dtmField>2008-01-28T01:01:00Z</dtmField>
  </record>
  <record>
    <Field1>Info</Field1>
    <Field2>Data2-2</Field2>
    <dtmField>2008-01-28T02:02:00Z</dtmField>
  </record>
  <record>
    <Field1>Data3-1</Field1>
    <Field2>Data3-2</Field2>
    <dtmField>2008-01-28T03:03:00Z</dtmField>
  </record>
  <record>
    <Field1>all</Field1>
    <Field2>Data4-2</Field2>
    <dtmField>2008-01-28T04:04:00Z</dtmField>
  </record>
  <record>
    <Field1>All</Field1>
    <Field2>Data5-2</Field2>
    <dtmField>2008-01-28T05:05:00Z</dtmField>
  </record>
  <record>
    <Field1>info</Field1>
    <Field2>Data6-2</Field2>
    <dtmField>2008-01-28T06:06:00Z</dtmField>
  </record>
</data>

XSL Stylesheet
<!-- Include this just to show version and output method -->
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform
<http://www.w3.org/1999/XSL/Transform> " version="1.0">
  <xsl:output method="html"/>

<!--
The "selected" value of thes parameters are filled in for this example.
Normally
they are passed from an external ASP VBScript that processes inputs from
another
form where the values are input by the user.
-->
  <xsl:param name="searchfield" select="Field1"/> <!-- Field to search -->
  <xsl:param name="searchtext" select="Data"/> <!-- Text to search for -->
  <xsl:param name="sortbyfield" select="Field2"/> <!-- Field to sort output by
-->
  <xsl:param name="sortorder" select="Descending"/> <!-- Sort order ascending
or descending -->

  <xsl:template name="textsearch">
    <xsl:for-each select="record[*[name() = $searchfield][contains(.,
$ProperText) or contains(., $UCASETEXT) or contains(., $lcasetext)]]">
      <xsl:sort select="*[name()=$sortbyfield]" order="{$sortorder}"/>
      <xsl:call-template name="resulttable"/>
    </xsl:for-each>
  </xsl:template>



Thanks Again,

Russ Lewis

Current Thread

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.