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

selectSingleNode and selectNodes method ...

Subject: selectSingleNode and selectNodes method ...
From: Éric Riblair <eriblair@xxxxxxxxxxxx>
Date: Mon, 28 Dec 1998 13:08:10 -0500
selectsinglenode
selectSingleNode and selectNodes method ...

Hi,

I just begin in XSL-server side and I want to search in particular xml
element in a xml file and I know that I have more than one element that
correspond to ... I do tests with the selectSingleNode and I have good
result except that I only have the first element of the matching pattern
... In fact, I do other tests with the selectNodes method (...method who
return all the element ...) but with no success ...

Can somebody help me,
That will be nice...
Eric

HERE IS THE ASP FILE:
:
<%@ LANGUAGE = JScript %>
<%

  // Error formatting function:
  function reportError(where, error)
  {
    Response.Write("<font face=Arial><B>Error loading '" + where +
"'</B></font> <BLOCKQUOTE><XMP>" + error.reason + "</XMP></BLOCKQUOTE>");
  }

  // Load the XML 
  var xmlDoc = Server.CreateObject("Microsoft.XMLDOM");
  xmlDoc.async = false;
  var weed = Request.QueryString("weed");
  var fileName = "Xml/PlantTypes.xml";
  xmlDoc.load(Server.MapPath(fileName));
  if (xmlDoc.parseError.errorCode != 0)
  {
    reportError(fileName, xmlDoc.parseError);
  }
  else
  {  
    // Load the stylesheet
    var style = Server.CreateObject("Microsoft.XMLDOM");
    style.async = false;
    var fileName = "Xsl/weed.xsl";
    style.load(Server.MapPath(fileName));
    if (style.parseError.errorCode != 0)
    {
      reportError(fileName, xmlDoc.parseError);
    }

    // Process it
    var pattern = "/SgPlantTypes/SgPlantType[@ID='" + weed + "']"; 
    var node = xmlDoc.documentElement.selectNodes(pattern);
    var result = node.transformNode(style);
    Response.Write(result);
  }
%>

AND HERE IS THE XSL FILE:
<?xml version="1.0"?>
<HTML xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<HEAD>
</HEAD>
  <BODY STYLE="font-family:Arial, helvetica, sans-serif; font-size:12pt;
        background-color:#FDF5B5">

        <TABLE  BORDER="0">
        <tr>
        <td><SPAN STYLE="margin-left:8pt; font-size:11pt; font-weight:bold; 
          padding-top:3pt; padding-bottom:3pt;">MAUVAISE HERBE:</SPAN>
          </td>
        </tr>
        <TR>
        <TD>
    <xsl:for-each select="node()">
            <DIV STYLE="margin-left:26pt; margin-right:1pt; font-size:10pt; 
             font-weight:bold; padding-top:0pt;">
            <xsl:value-of select="@NAME"/>
            </DIV>
    </xsl:for-each>
        </TD>
        </TR>
        </TABLE>
  </BODY>
</HTML>


 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.