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

problem with xml searching with xsl

Subject: problem with xml searching with xsl
From: Gatis <mr.g@xxxxxxxxx>
Date: Tue, 30 Sep 2003 16:51:50 +0300
xml searching
Hi!

I'm a new in xml/xsl and have a problem with user input handling.
The aim is to create searchable xml database on the cdrom. I have the xml and
xsl for user input handling and searching. Unfortunately it didn't works.
First attemt was:
<?xml version="1.0" encoding="ISO-8859-1"?>

<xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:msxsl="urn:schemas-microsoft-com:xslt">

<xsl:output method="html"/>

<xsl:template match="/">
  <html>
  <body>

<form method="get">
<xsl:element name="input">
<xsl:attribute name="name">search</xsl:attribute>
<xsl:attribute name="value"><xsl:value-of select="search"/>
</xsl:attribute>
</xsl:element>
<input type="submit" name="button"/>
 </form>

 <table border="1">
      <tr bgcolor="#9acd32">
        <th align="left">kods</th>
        <th align="left">nosaukums</th>
      </tr>
      <xsl:for-each select="Import/Row">
       <xsl:if test="contains(NOSAUKUMS, @search)">
      <tr>
        <td><xsl:value-of select="KODS"/></td>
        <td><xsl:value-of select="NOSAUKUMS"/></td>
      </tr>
      </xsl:if>
      </xsl:for-each>
    </table>
     
  </body>
  </html>
</xsl:template>

</xsl:stylesheet>


Then I try to get values for searching from url string, but javascript didn't executes.

<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited with XML Spy v4.2 -->
<xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:msxsl="urn:schemas-microsoft-com:xslt"
      xmlns:user="http://mycompany.com/mynamespace">
 <xsl:output method="html"/>
<xsl:template match="/">
  <html>
  <body>

<form method="get">
<xsl:element name="input">
<xsl:attribute name="name">search</xsl:attribute>
<xsl:attribute name="value"><xsl:value-of select="search"/>
</xsl:attribute>
</xsl:element>
<input type="submit" name="button"/>
 </form>

<xsl:variable name="url">
<msxsl:script language="JavaScript">
var url;
url = location.href;
document.write(url);
document.write(location.href);
</msxsl:script>
</xsl:variable>

 <table border="1">
      <tr bgcolor="#9acd32">
        <th align="left">kods</th>
        <th align="left">nosaukums</th>
      </tr>
      <xsl:for-each select="Import/Row">
       <xsl:if test="contains(NOSAUKUMS, $url)">
      <tr>
        <td><xsl:value-of select="KODS"/></td>
        <td><xsl:value-of select="NOSAUKUMS"/></td>
      </tr>
      </xsl:if>
      </xsl:for-each>
    </table>
     
  </body>
  </html>
</xsl:template>

</xsl:stylesheet>

Pls help!

obender


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


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.