[xsl] modifying an XSLT Document at runtime

Subject: [xsl] modifying an XSLT Document at runtime
From: "Sanjay Pandey/Towers Perrin" <pandeys@xxxxxxxxxx>
Date: Thu, 6 Dec 2001 08:46:04 -0500
Hi List,

I have a XML as below ("ErrorMessages.xml")
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="formatErrors.xsl" media="screen"?>
<ErrorMessages xmlns:xs="http://www.w3.org/2001/Schema";>

And XSL is as below ("formatErrors.xsl")
<?xml version="1.0"?>
<!-- <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl";>  -->
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<!-- <xsl:output method="html"/>  -->

     <!-- Get error message data   -->
     <xsl:template match="/">
          <title>Error Messages</title>
                    var xslStylesheet=null;
                    var xmlSource = null;
                    var attribNode = null;

                    function sort(field)
                         attribNode.value = field;


     <script for="window" event="onload">>
                    xmlSource = document.XMLDocument;
<!--                xmlSource.load("ErrorMessages.xml");  -->
                    attribNode = document.XSLDocument.selectSingleNode

          <div id="ErrorMessages"></div>
     <xsl:template match="ErrorMessages">

        <table border ="0" frame="border" cellspacing ="0" width="100%">
        <thead title="Alt-click sorts in descending order.">
        <tr style="background:brown;color:red;font-size:10pt">
          <th onclick="sort('errorType')" width="20%" style="cursor:hand;">
          <th onclick="sort('fieldName')" width="20%" style="cursor:hand;">
          <th onclick="sort('description')" width="20%" style
        <tbody id="ErrorMessages_body">
          <xsl:for-each select ="//errorMessage">
          <xsl:sort select ="errorType"/>

               <td>      <xsl:value-of select ="errorType"/> </td>
               <td>      <xsl:value-of select ="fieldName"/> </td>
               <td>      <xsl:value-of select ="description"/> </td>


I am unable to get it working. When I open the XML in IE5.5, I get syntax
error in line 21 (which appears to be one in XSL with "attribNode.value =
field". This example I am trying is supposed to format my ErrorMessage XML
file so that I have SORT facility while viewing the ErrorMessages.

I have taken most of it from Chapter 9 of Professional XML (wrox).

What is wrong here? Any help would be highly appreciated.


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

Current Thread