[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1938
  • Last Modified:

XML Data Islands and <ul>

Is it possible to bind xml data-islands to anything other than html tables?
I'd like to output the info as a <ul> but it doesn't seem to do it.


I need to output data like this, I realise the syntax is wrong, but am not sure how to do it - do I have to build it in a javascript funtion instead?:

Thanks

<html>
<body>

<xml id="sitelist" src="site_info.xml"></xml>

<ul datasrc="#sitelist">
<li><a href="datafld='URL'"><span datafld="TITLE"></span></a></li>
</ul>

</body>
</html>
0
Lady_M
Asked:
Lady_M
  • 57
  • 42
  • 26
2 Solutions
 
Geert BormansCommented:
data islands are a slow, unflexible and microsoft only way of pulling a table like XML in a html table
You can't do anything else with it.
I would highly recommend you to have a javascript function that calls an XSLT
(XSLT is a standardised language for transforming XML)
If you use sarissa library, you could make this browser independent

here is a quick intro into XSLT
http://www.w3schools.com/xsl/default.asp

If you show me the XML, I can get you started
0
 
Geert BormansCommented:
I forgot to say that data islands are also old, and not really recommended for use these days
0
 
Lady_MAuthor Commented:
Hi Gertone
Thanks for getting back to me.  I was beginning to think there was nobody around this weekend.  

I'm really quite stuck.  I've started reading up about XSLT, but I'm not sure it's going to be suitable for what I'm trying to achieve.
So can you tell me step by step which components I need (I can try to work out the code).
I have an XML data sheet with all my stuff in it which seems fine.  The DTD is in the top of that.
I have an HTML template (index.html) that uses a CSS stylesheet and I need to import different cuts of this XML data into in three places in the page.These three outputs of XML data are likely to end up as server side includes to import into my template, so I guess they could be saved as xml files if necessary.
 
(please see http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/XML/Q_22906481.html for an explanation of that).  

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Geert BormansCommented:
The simplest way to deal with this is to add a xsl-stylesheet to your XML and reference this XSLT

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
    <xsl:template match="/">
        <html id="sixapart-standard">
            <!--body class = sport or entertainment or whatever-->
            <body class="">
                <ul>
                    <xsl:apply-templates select="//SITE" />
                </ul>
            </body>
        </html>
    </xsl:template>
    <xsl:template match="SITE">
        <li>
            <a href="{SITEURL}"><span><xsl:value-of select="SITETITLE"/></span></a>
        </li>
     </xsl:template>
</xsl:stylesheet>

store this xslt in a file eg "siteurl.xsl"
store the file in the same directory as the XML
and add this line to the xml
<?xml version='1.0'?>
<?xml-stylesheet type="text/xsl" href="siteurl.xsl"?>
<!DOCTYPE LISTS [
...

If you now open the XML in the browser, the browser will execute the XSLT and show the resulting HTML

This is the simplest way to use XSLT, far more flexible than data islands and works in most recent browsers
If you need more control

cheers

Geert
0
 
Lady_MAuthor Commented:
Hi there
Thanks for that.
Does this mean though that my index page has to actually have an xml file extension?
Or should I create 3 separate xml include files for each list I want in my html template?
Because my template needs to be an html page.
0
 
Geert BormansCommented:
This only works for one xml and one xslt
If you need to include several xml files, you need some javascript
The index file is preferably an .xml extension since the server has to pass it with an xml mimetype
is browser independence important or are you building this for IE only?
0
 
Lady_MAuthor Commented:
I tried that, and it displays the data thanks.  That's a good start.
But I'll try to explain better what I'm trying to achieve:

I have a long, complex Movable Type template which has to be a .html file.  It has various includes such as header, footer, adverts, menus, etc.
And on 3 different points in the page I need to output some of the data from this XML file.  The data to display will be slightly different each time and it will also be styled differently each time.  And I would like to create it as 3 separate widgets to include in the template.

1) In the header I need to display all the site names as urls, but I need them to be grouped by their theme.
2) Then in in a menu I need to display ONLY the site names as urls for the theme that matches the body class tag
3) And then in a list further down the page I need to display the image as a link with the alt tag, but ONLY for the theme that matches the body class.


I'm really confused how to do this.  I presumably have to create 3 separate XSLT files.  But I can't link to all of them in the XML file can I.  And I don't actually want to have my template as an XML file anyway.  Rather an an html file with XML widgets included in it.
0
 
Lady_MAuthor Commented:
It's got to be cross-browser compatible.

Okay so Javascript, does that mean, no XSLT?
0
 
Geert BormansCommented:
OK, now I understand,

There are basically two things you can do
- get the elements from the XML using selectNodes, and loop through the nodesets you retrieve back
- use three XSLTs (or one XSLT with parameters, if applicable)
In both cases I recommend using sarissa cross browser scripts
0
 
Lady_MAuthor Commented:
So when you say selectNodes, you presumably mean with Javascript?

If I use three XSLTs, do I put a link to all three in my xml data file?  How will it know when to do what?

And what do I put into my html template?  When I get to the point in the html code where I want to output some data (or actually include the external include file), do I include the XSLT file or the XML file or something else?

I'm going to look up Sarissa, never heard of that.
0
 
Geert BormansCommented:
> So when you say selectNodes, you presumably mean with Javascript?

yes

> do I put a link to all three in my xml data file?

no,
what you should do then is wrap every XSLT in a function
and replace the innerHTML of a div in your template inside this function

I show you how to deal with that in one function

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" onclick="clearMetaSelector();">
<head>
<title>Sarissa Demo</title>
    <script type="text/javascript" src="sarissa/sarissa.js"></script>
    <script type="text/javascript" src="sarissa/sarissa_ieemu_xpath.js"></script>
    <script type="text/javascript" language="JavaScript">
      <!--
      var oXmlDoc;
      var oXslDoc;
      var showCounter = 10;

      function init()
            {
        // create the xml document object
        oXmlDoc = Sarissa.getDomDocument();
        oXmlDoc.async = false;
        oXmlDoc.load("siteurl.xml");
        // create the xml document object
        oXslDoc = Sarissa.getDomDocument();
        oXslDoc.async = false;
        oXslDoc.load("siteurl.xsl");
        showURL(); //
        }

      function showURL()
      {
        var xsltProc  = new XSLTProcessor();
        xsltProc.importStylesheet(oXslDoc);
        var resFrag = xsltProc.transformToDocument(oXmlDoc);
        document.getElementById("URL").innerHTML = new XMLSerializer().serializeToString(resFrag);
      }
     
     
      //-->
    </script>
</head>

<body onload="init();" >
  <div id="URL"></div>
</body>
</html>

onload you initialise the xml objects
in the init function you also call one function that then replaces the content of the div with id = "URL"
you can do a similar thing three times

you need to simplify your XSLT

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:template match="/">
                <ul>
                    <xsl:apply-templates select="//SITE" />
                </ul>
    </xsl:template>
    <xsl:template match="SITE">
        <li>
            <a href="{SITEURL}"><span><xsl:value-of select="SITETITLE"/></span></a>
        </li>
     </xsl:template>
</xsl:stylesheet>

cheers

Geert

0
 
Geert BormansCommented:
off course you need to download sarissa
http://sourceforge.net/projects/sarissa

cheers

Geert
0
 
Lady_MAuthor Commented:
Ah I think I see.  Although my head is spinning.  Thankyou for all that.

Okay so I just have to create two further functions: function showCategoryList()  and
function showImageList()  and add those to init().  Is that right?

One important thing:  could you please show me how I would select only those sites that have a CATEGORY NAME equal to the body class please?

<!DOCTYPE CATEGORIES [
<!ELEMENT CATEGORIES (CATEGORY+)>
<!ELEMENT CATEGORY (NAME+,CATEGORYIMAGE,BLOGS+)>
<!ELEMENT NAME (#PCDATA)>
<!ELEMENT CATEGORYIMAGE (#PCDATA)>
<!ELEMENT SITES (SITE+)>
<!ELEMENT SITE (SITETITLE+,SITEURL+,STATSCODE?,MAILID?,SITEMAGE+)>
<!ELEMENT SITETITLE (#PCDATA)>
<!ELEMENT SITEURL (#PCDATA)>
<!ELEMENT STATSCODE (#PCDATA)>
<!ELEMENT MAILID (#PCDATA)>
<!ELEMENT SITEIMAGE (SITEIMAGEPATH?,SITEIMAGEALT?)>
<!ELEMENT SITEIMAGEPATH (#PCDATA)>
<!ELEMENT SITEIMAGEALT (#PCDATA)>
]>

<CATEGORIES>
      <CATEGORY NAME="Sport">

      <CATEGORYIMAGE>sport.gif</CATEGORYIMAGE>

      <SITES>
      
            <SITE>
            <SITETITLE>My Title</SITETITLE>
0
 
Lady_MAuthor Commented:
           <SITEURL>www.mysite.com</SITEURL>
            <SITEIMAGE>
                  <SITEIMAGEPATH>/sport/image.jpg</SITEIMAGEPATH>
                  <SITEIMAGEALT>Visit my site</SITEIMAGEALT>
            </SITEIMAGE>
            </SITE>

<SITE>...
0
 
Geert BormansCommented:
If body class is in your html template,
you need to find a way to pass that as a parameter to the template


    function showURL()
      {
        var xsltProc  = new XSLTProcessor();
        xsltProc.importStylesheet(oXslDoc);
        xsltProc.setParameter('', 'cat' , 'Sport');
        var resFrag = xsltProc.transformToDocument(oXmlDoc);
        document.getElementById("URL").innerHTML = new XMLSerializer().serializeToString(resFrag);
      }

using setParameter with the second argument being the XSLT parameter
and the third one being the value ('Sport' in this case)
you get access to this parameter in the XSLT

In the XSLT you then need to declare the parameter at the highest level
<xsl:param name='cat'/>

and you can use that as $cat
(so the variable $cat will have the value 'Sport')

Here is how the slective stylesheet would be
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:param name='cat'/>
    <xsl:template match="/">
                <ul>
                    <xsl:apply-templates select="//CATEGORY[@NAME = $cat]/SITES/SITE" />
                </ul>
    </xsl:template>
    <xsl:template match="SITE">
        <li>
            <a href="{SITEURL}"><span><xsl:value-of select="SITETITLE"/></span></a>
        </li>
     </xsl:template>
</xsl:stylesheet>

cheers

Geert
     

0
 
Lady_MAuthor Commented:
Hi Geert,  I really hope you aren't going anywhere.  This is just getting more and more horrible.

I will read through what you've just written in a sec, but I've just finished downloading Sarissa and there are about 10 subfolders and tonnes of files in the zip download.

Do I need them all or only these two?
  <script type="text/javascript" src="sarissa/sarissa.js"></script>
    <script type="text/javascript" src="sarissa/sarissa_ieemu_xpath.js"></script>

Thanks
0
 
Geert BormansCommented:
>Do I need them all or only these two?

just the two referenced in the script tags
0
 
Geert BormansCommented:
It might seem horrible for now,
but give it a little bit of time
and you will realise that you discovered a powerfull weapon for exploiting XML data in HTML pages

All you are doing is
- pick a piece of XML
- transform it to the html you need
- and stuff it in your template html, where you need it

Sarissa is just there to hide all the cross browser hocus pocus from your programs

cheers

Geert
0
 
Lady_MAuthor Commented:
Okay so another question:

        // create the xsl document object
        oXslDoc = Sarissa.getDomDocument();
        oXslDoc.async = false;
        oXslDoc.load("navL1.xsl");
        showNavL1(); //


would become

        // create the xsl document object
        oXslDoc = Sarissa.getDomDocument();
        oXslDoc.async = false;
        oXslDoc.load("navL1.xsl");
        oXslDoc.load("navL2.xsl");
        oXslDoc.load("imageLinkSet.xsl");
        showNavL1();
        showNavL2();
        showImageLinkSet();//

why are those comment forward slashes at the end there??
0
 
Lady_MAuthor Commented:
Thanks Geert.  You're being a huge help.
It kind of makes sense in principle.  And I know it's going to be useful.  But I have to finish this tonight.  : |
0
 
Geert BormansCommented:
oXslDoc.load("navL1.xsl");
... no, this way you would load three XSLTs into the same object

       // create the xsl document objects
        oXslNavL1Doc = Sarissa.getDomDocument();
        oXslNavL1Doc.async = false;
        oXslNavL1Doc.load("navL1.xsl");
        oXslNavL2Doc = Sarissa.getDomDocument();
        oXslNavL2Doc.async = false;
        oXslNavL2Doc.load("navL2.xsl");
        oXslImgDoc = Sarissa.getDomDocument();
        oXslImgDoc.async = false;
        oXslImgDoc.load("imageLinkSet.xsl");
        showNavL1();
        showNavL2();
        showImageLinkSet();

is more like it
use the correct xsl object in the correct function

the // is a remainder from an old comment

cheers
0
 
Geert BormansCommented:
When is tonight, I am in CET, it is almost 10 PM where I live
0
 
Lady_MAuthor Commented:
It's 9pm here.  Tonight as in 2am probably.  But this is not your problem Geert.  I am going to get some caffeine.

Here is a test link by the way: http://www.webtasticdesigns.co.uk/testarea/xml/bloglist/test.htm
0
 
Lady_MAuthor Commented:
I keep getting the javascript error on line 19:  Sarissa undefined from this line:
        oXmlDoc = Sarissa.getDomDocument();
0
 
Geert BormansCommented:
it seems the sarissa libraries aren't loaded
is this a non-windows machine?
maybe you have a case sensitivity problem with the files
0
 
Lady_MAuthor Commented:
No it's windows.  But the error is happening on my host server on the link I posted above.  I will check the case, but I haven't changed anything.
0
 
Geert BormansCommented:
I just compared my sarissa.js with the one on your server and you seem to have development files rather than production files
Did you pull this off a SVN?
Try to find the download of the stable production files
take the zip with 0.8.9.1
cheers

Geert
0
 
Lady_MAuthor Commented:
I downloaded sarissa-0.9.8.1 from http://sourceforge.net/project/showfiles.php?group_id=75155&package_id=75592

I'll try to find that one.
0
 
Lady_MAuthor Commented:
I can't find any going back that far. And did a search and it didn't find anything.
Did you really mean 0.8.9.1?  Or was that a typo?
There doesn't appear to be anything like that on the site.
0
 
hieloCommented:
Lady_M:
I noticed you deleted your test.html and a couple of xsl files. I hope you have a copy of the xsl files elsewhere. I could not find them. Your headaches were not helped by the bugs in Sarissa. Additionally, you were dereferencing nodes incorrectly in your dropDown.xsl file, that is why you were not seeing any results. The files follow:

dropDown.xsl
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
     <xsl:template match="/">
                    <xsl:apply-templates select="CATEGORIES" />
    </xsl:template>

     <xsl:template match="CATEGORIES">
                <ul>
                    <xsl:apply-templates select="CATEGORY" />
                </ul>
    </xsl:template>

    <xsl:template match="CATEGORY">
        <li>
            <span><xsl:value-of select="@NAME"/></span>
        </li>
     </xsl:template>


 
    <xsl:template match="BLOGS">
                <ul>
                    <xsl:apply-templates select="BLOG" />
                </ul>
    </xsl:template>
    <xsl:template match="BLOG">

        <li>
            <a href="{BLOGURL}"><span><xsl:value-of select="BLOGTITLE"/></span></a>
        </li>
     </xsl:template>
</xsl:stylesheet>

0
 
hieloCommented:
test.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" onclick="clearMetaSelector();">
<head>
<title>Sarissa Demo</title>
    <!-- <script type="text/javascript" src="sarissa/sarissa.js"></script> -->
    <script type="text/javascript"><!--

    /**
 * ====================================================================
 * About
 * ====================================================================
 * Sarissa is an ECMAScript library acting as a cross-browser wrapper for native XML APIs.
 * The library supports Gecko based browsers like Mozilla and Firefox,
 * Internet Explorer (5.5+ with MSXML3.0+), Konqueror, Safari and a little of Opera
 * @version ${project.version}
 * @author: @author: Copyright 2004-2007 Emmanouil Batsis, mailto: mbatsis at users full stop sourceforge full stop net
 *
 * ====================================================================
 * Licence
 * ====================================================================
 * Sarissa is free software distributed under the GNU GPL version 2 (see <a href="../../sarissa/sarissa/gpl.txt">gpl.txt</a>) or higher,
 * GNU LGPL version 2.1 (see <a href="../../sarissa/sarissa/lgpl.txt">lgpl.txt</a>) or higher and Apache Software License 2.0 or higher
 * (see <a href="../../sarissa/sarissa/asl.txt">asl.txt</a>). This means you can choose one of the three and use that if you like. If
 * you make modifications under the ASL, i would appreciate it if you submitted those.
 * In case your copy of Sarissa does not include the license texts, you may find
 * them online in various formats at <a href="http://www.gnu.org">http://www.gnu.org</a> and
 * <a href="http://www.apache.org">http://www.apache.org</a>.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
 * KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
 * WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE
 * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
/**
 * <p>Sarissa is a utility class. Provides "static" methods for DOMDocument,
 * DOM Node serialization to XML strings and other utility goodies.</p>
 * @constructor
 */
function Sarissa(){};
Sarissa.VERSION = "${project.version}";
Sarissa.PARSED_OK = "Document contains no parsing errors";
Sarissa.PARSED_EMPTY = "Document is empty";
Sarissa.PARSED_UNKNOWN_ERROR = "Not well-formed or other error";
Sarissa.IS_ENABLED_TRANSFORM_NODE = false;
var _sarissa_iNsCounter = 0;
var _SARISSA_IEPREFIX4XSLPARAM = "";
var _SARISSA_HAS_DOM_IMPLEMENTATION = document.implementation && true;
var _SARISSA_HAS_DOM_CREATE_DOCUMENT = _SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.createDocument;
var _SARISSA_HAS_DOM_FEATURE = _SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.hasFeature;
var _SARISSA_IS_MOZ = _SARISSA_HAS_DOM_CREATE_DOCUMENT && _SARISSA_HAS_DOM_FEATURE;
var _SARISSA_IS_SAFARI = navigator.userAgent.toLowerCase().indexOf("safari") != -1 || navigator.userAgent.toLowerCase().indexOf("konqueror") != -1;
var _SARISSA_IS_SAFARI_OLD = _SARISSA_IS_SAFARI && parseInt((navigator.userAgent.match(/AppleWebKit\/(\d+)/)||{})[1]) < 420;
var _SARISSA_IS_IE = document.all && window.ActiveXObject && navigator.userAgent.toLowerCase().indexOf("msie") > -1  && navigator.userAgent.toLowerCase().indexOf("opera") == -1;
var _SARISSA_IS_OPERA = navigator.userAgent.toLowerCase().indexOf("opera") != -1;
if(!window.Node || !Node.ELEMENT_NODE){
    Node = {ELEMENT_NODE: 1, ATTRIBUTE_NODE: 2, TEXT_NODE: 3, CDATA_SECTION_NODE: 4, ENTITY_REFERENCE_NODE: 5,  ENTITY_NODE: 6, PROCESSING_INSTRUCTION_NODE: 7, COMMENT_NODE: 8, DOCUMENT_NODE: 9, DOCUMENT_TYPE_NODE: 10, DOCUMENT_FRAGMENT_NODE: 11, NOTATION_NODE: 12};
};

//This breaks for(x in o) loops in the old Safari
if(_SARISSA_IS_SAFARI_OLD){
    HTMLHtmlElement = document.createElement("html").constructor;
    Node = HTMLElement = {};
    HTMLElement.prototype = HTMLHtmlElement.__proto__.__proto__;
    HTMLDocument = Document = document.constructor;
    var x = new DOMParser();
    XMLDocument = x.constructor;
    Element = x.parseFromString("<Single />", "text/xml").documentElement.constructor;
    x = null;
}
if(typeof XMLDocument == "undefined" && typeof Document !="undefined"){ XMLDocument = Document; }

// IE initialization
if(_SARISSA_IS_IE){
    // for XSLT parameter names, prefix needed by IE
    _SARISSA_IEPREFIX4XSLPARAM = "xsl:";
    // used to store the most recent ProgID available out of the above
    var _SARISSA_DOM_PROGID = "";
    var _SARISSA_XMLHTTP_PROGID = "";
    var _SARISSA_DOM_XMLWRITER = "";
    /**
     * Called when the Sarissa_xx.js file is parsed, to pick most recent
     * ProgIDs for IE, then gets destroyed.
     * @private
     * @param idList an array of MSXML PROGIDs from which the most recent will be picked for a given object
     * @param enabledList an array of arrays where each array has two items; the index of the PROGID for which a certain feature is enabled
     */
    Sarissa.pickRecentProgID = function (idList){
        // found progID flag
        var bFound = false, e;
        for(var i=0; i < idList.length && !bFound; i++){
            try{
                var oDoc = new ActiveXObject(idList[i]);
                var o2Store = idList[i];
                bFound = true;
            }catch (objException){
                // trap; try next progID
                e = objException;
            };
        };
        if (!bFound) {
            throw "Could not retrieve a valid progID of Class: " + idList[idList.length-1]+". (original exception: "+e+")";
        };
        idList = null;
        return o2Store;
    };
    // pick best available MSXML progIDs
    _SARISSA_DOM_PROGID = null;
    _SARISSA_THREADEDDOM_PROGID = null;
    _SARISSA_XSLTEMPLATE_PROGID = null;
    _SARISSA_XMLHTTP_PROGID = null;
    if(!window.XMLHttpRequest){
        /**
         * Emulate XMLHttpRequest
         * @constructor
         */
        XMLHttpRequest = function() {
            if(!_SARISSA_XMLHTTP_PROGID){
                _SARISSA_XMLHTTP_PROGID = Sarissa.pickRecentProgID(["Msxml2.XMLHTTP.6.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"]);
            };
            return new ActiveXObject(_SARISSA_XMLHTTP_PROGID);
        };
    };
    // we dont need this anymore
    //============================================
    // Factory methods (IE)
    //============================================
    // see non-IE version
    Sarissa.getDomDocument = function(sUri, sName){
        if(!_SARISSA_DOM_PROGID){
            _SARISSA_DOM_PROGID = Sarissa.pickRecentProgID(["Msxml2.DOMDocument.6.0", "Msxml2.DOMDocument.3.0", "MSXML2.DOMDocument", "MSXML.DOMDocument", "Microsoft.XMLDOM"]);
        };
        var oDoc = new ActiveXObject(_SARISSA_DOM_PROGID);
        // if a root tag name was provided, we need to load it in the DOM object
        if (sName){
            // create an artifical namespace prefix
            // or reuse existing prefix if applicable
            var prefix = "";
            if(sUri){
                if(sName.indexOf(":") > 1){
                    prefix = sName.substring(0, sName.indexOf(":"));
                    sName = sName.substring(sName.indexOf(":")+1);
                }else{
                    prefix = "a" + (_sarissa_iNsCounter++);
                };
            };
            // use namespaces if a namespace URI exists
            if(sUri){
                oDoc.loadXML('<' + prefix+':'+sName + " xmlns:" + prefix + "=\"" + sUri + "\"" + " />");
            } else {
                oDoc.loadXML('<' + sName + " />");
            };
        };
        return oDoc;
    };
    // see non-IE version  
    Sarissa.getParseErrorText = function (oDoc) {
        var parseErrorText = Sarissa.PARSED_OK;
        if(oDoc && oDoc.parseError && oDoc.parseError.errorCode && oDoc.parseError.errorCode != 0){
            parseErrorText = "XML Parsing Error: " + oDoc.parseError.reason +
                "\nLocation: " + oDoc.parseError.url +
                "\nLine Number " + oDoc.parseError.line + ", Column " +
                oDoc.parseError.linepos +
                ":\n" + oDoc.parseError.srcText +
                "\n";
            for(var i = 0;  i < oDoc.parseError.linepos;i++){
                parseErrorText += "-";
            };
            parseErrorText +=  "^\n";
        }
        else if(oDoc.documentElement == null){
            parseErrorText = Sarissa.PARSED_EMPTY;
        };
        return parseErrorText;
    };
    // see non-IE version
    Sarissa.setXpathNamespaces = function(oDoc, sNsSet) {
        oDoc.setProperty("SelectionLanguage", "XPath");
        oDoc.setProperty("SelectionNamespaces", sNsSet);
    };  
    /**
     * Basic implementation of Mozilla's XSLTProcessor for IE.
     * Reuses the same XSLT stylesheet for multiple transforms
     * @constructor
     */
    XSLTProcessor = function(){
        if(!_SARISSA_XSLTEMPLATE_PROGID){
            _SARISSA_XSLTEMPLATE_PROGID = Sarissa.pickRecentProgID(["Msxml2.XSLTemplate.6.0", "MSXML2.XSLTemplate.3.0"]);
        };
        this.template = new ActiveXObject(_SARISSA_XSLTEMPLATE_PROGID);
        this.processor = null;
    };
    /**
     * Imports the given XSLT DOM and compiles it to a reusable transform
     * <b>Note:</b> If the stylesheet was loaded from a URL and contains xsl:import or xsl:include elements,it will be reloaded to resolve those
     * @argument xslDoc The XSLT DOMDocument to import
     */
    XSLTProcessor.prototype.importStylesheet = function(xslDoc){
                if(typeof(xslDoc)=="undefined"){
                  alert("You are trying to import a stylesheed but did not pass a valid xslDoc object");
                  return null;
            }
        if(!_SARISSA_THREADEDDOM_PROGID){
            _SARISSA_THREADEDDOM_PROGID = Sarissa.pickRecentProgID(["MSXML2.FreeThreadedDOMDocument.6.0", "MSXML2.FreeThreadedDOMDocument.3.0"]);
        };
        xslDoc.setProperty("SelectionLanguage", "XPath");
        xslDoc.setProperty("SelectionNamespaces", "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'");
        // convert stylesheet to free threaded
        var converted = new ActiveXObject(_SARISSA_THREADEDDOM_PROGID);
        // make included/imported stylesheets work if exist and xsl was originally loaded from url
        try{
            converted.resolveExternals = true;
            converted.setProperty("AllowDocumentFunction", true);
        }
        catch(e){
            // Ignore. "AllowDocumentFunction" is only supported in MSXML 3.0 SP4 and later.
        };
        if(xslDoc.url && xslDoc.selectSingleNode("//xsl:*[local-name() = 'import' or local-name() = 'include']") != null){
            converted.async = false;
            converted.load(xslDoc.url);
        } else {
            converted.loadXML(xslDoc.xml);
        };
        converted.setProperty("SelectionNamespaces", "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'");
        var output = converted.selectSingleNode("//xsl:output");
        this.outputMethod = output ? output.getAttribute("method") : "html";
        this.template.stylesheet = converted;
        this.processor = this.template.createProcessor();
        // for getParameter and clearParameters
        this.paramsSet = [];
    };

    /**
     * Transform the given XML DOM and return the transformation result as a new DOM document
     * @argument sourceDoc The XML DOMDocument to transform
     * @return The transformation result as a DOM Document
     */
    XSLTProcessor.prototype.transformToDocument = function(sourceDoc){
        // fix for bug 1549749
        if(_SARISSA_THREADEDDOM_PROGID){
            this.processor.input=sourceDoc;
            var outDoc=new ActiveXObject(_SARISSA_DOM_PROGID);
            this.processor.output=outDoc;
            this.processor.transform();
            return outDoc;
        }
        else{
            if(!_SARISSA_DOM_XMLWRITER){
                _SARISSA_DOM_XMLWRITER = Sarissa.pickRecentProgID(["Msxml2.MXXMLWriter.6.0", "Msxml2.MXXMLWriter.3.0", "MSXML2.MXXMLWriter", "MSXML.MXXMLWriter", "Microsoft.XMLDOM"]);
            };
            this.processor.input = sourceDoc;
            var outDoc = new ActiveXObject(_SARISSA_DOM_XMLWRITER);
            this.processor.output = outDoc;
            this.processor.transform();
            var oDoc = new ActiveXObject(_SARISSA_DOM_PROGID);
            oDoc.loadXML(outDoc.output+"");
            return oDoc;
        };
    };
   
    /**
     * Transform the given XML DOM and return the transformation result as a new DOM fragment.
     * <b>Note</b>: The xsl:output method must match the nature of the owner document (XML/HTML).
     * @argument sourceDoc The XML DOMDocument to transform
     * @argument ownerDoc The owner of the result fragment
     * @return The transformation result as a DOM Document
     */
    XSLTProcessor.prototype.transformToFragment = function (sourceDoc, ownerDoc) {
        this.processor.input = sourceDoc;
        this.processor.transform();
        var s = this.processor.output;
        var f = ownerDoc.createDocumentFragment();
        if (this.outputMethod == 'text') {
            f.appendChild(ownerDoc.createTextNode(s));
        } else if (ownerDoc.body && ownerDoc.body.innerHTML) {
            var container = ownerDoc.createElement('div');
            container.innerHTML = s;
            while (container.hasChildNodes()) {
                f.appendChild(container.firstChild);
            }
        }
        else {
            var oDoc = new ActiveXObject(_SARISSA_DOM_PROGID);
            if (s.substring(0, 5) == '<?xml') {
                s = s.substring(s.indexOf('?>') + 2);
            }
            var xml = ''.concat('<my>', s, '</my>');
            oDoc.loadXML(xml);
            var container = oDoc.documentElement;
            while (container.hasChildNodes()) {
                f.appendChild(container.firstChild);
            }
        }
        return f;
    };
   
    /**
     * Set global XSLT parameter of the imported stylesheet
     * @argument nsURI The parameter namespace URI
     * @argument name The parameter base name
     * @argument value The new parameter value
     */
     XSLTProcessor.prototype.setParameter = function(nsURI, name, value){
         // make value a zero length string if null to allow clearing
         value = value ? value : "";
         // nsURI is optional but cannot be null
         if(nsURI){
             this.processor.addParameter(name, value, nsURI);
         }else{
             this.processor.addParameter(name, value);
         };
         // update updated params for getParameter
         nsURI = "" + (nsURI || "");
         if(!this.paramsSet[nsURI]){
             this.paramsSet[nsURI] = new Array();
         };
         this.paramsSet[nsURI][name] = value;
     };
    /**
     * Gets a parameter if previously set by setParameter. Returns null
     * otherwise
     * @argument name The parameter base name
     * @argument value The new parameter value
     * @return The parameter value if reviously set by setParameter, null otherwise
     */
    XSLTProcessor.prototype.getParameter = function(nsURI, name){
        nsURI = "" + (nsURI || "");
        if(this.paramsSet[nsURI] && this.paramsSet[nsURI][name]){
            return this.paramsSet[nsURI][name];
        }else{
            return null;
        };
    };
    /**
     * Clear parameters (set them to default values as defined in the stylesheet itself)
     */
    XSLTProcessor.prototype.clearParameters = function(){
        for(var nsURI in this.paramsSet){
            for(var name in this.paramsSet[nsURI]){
                if(nsURI!=""){
                    this.processor.addParameter(name, "", nsURI);
                }else{
                    this.processor.addParameter(name, "");
                };
            };
        };
        this.paramsSet = new Array();
    };
}else{ /* end IE initialization, try to deal with real browsers now ;-) */
    if(_SARISSA_HAS_DOM_CREATE_DOCUMENT){
        /**
         * <p>Ensures the document was loaded correctly, otherwise sets the
         * parseError to -1 to indicate something went wrong. Internal use</p>
         * @private
         */
        Sarissa.__handleLoad__ = function(oDoc){
            Sarissa.__setReadyState__(oDoc, 4);
        };
        /**
        * <p>Attached by an event handler to the load event. Internal use.</p>
        * @private
        */
        _sarissa_XMLDocument_onload = function(){
            Sarissa.__handleLoad__(this);
        };
        /**
         * <p>Sets the readyState property of the given DOM Document object.
         * Internal use.</p>
         * @private
         * @argument oDoc the DOM Document object to fire the
         *          readystatechange event
         * @argument iReadyState the number to change the readystate property to
         */
        Sarissa.__setReadyState__ = function(oDoc, iReadyState){
            oDoc.readyState = iReadyState;
            oDoc.readystate = iReadyState;
            if (oDoc.onreadystatechange != null && typeof oDoc.onreadystatechange == "function") {
                oDoc.onreadystatechange();
            }
        };
        Sarissa.getDomDocument = function(sUri, sName){
            var oDoc = document.implementation.createDocument(sUri?sUri:null, sName?sName:null, null);
            if(!oDoc.onreadystatechange){
           
                /**
                * <p>Emulate IE's onreadystatechange attribute</p>
                */
                oDoc.onreadystatechange = null;
            };
            if(!oDoc.readyState){
                /**
                * <p>Emulates IE's readyState property, which always gives an integer from 0 to 4:</p>
                * <ul><li>1 == LOADING,</li>
                * <li>2 == LOADED,</li>
                * <li>3 == INTERACTIVE,</li>
                * <li>4 == COMPLETED</li></ul>
                */
                oDoc.readyState = 0;
            };
            oDoc.addEventListener("load", _sarissa_XMLDocument_onload, false);
            return oDoc;
        };
        if(window.XMLDocument){
            // do nothing
        }// TODO: check if the new document has content before trying to copynodes, check  for error handling in DOM 3 LS
        else if(_SARISSA_HAS_DOM_FEATURE && window.Document && !Document.prototype.load && document.implementation.hasFeature('LS', '3.0')){
            //Opera 9 may get the XPath branch which gives creates XMLDocument, therefore it doesn't reach here which is good
            /**
            * <p>Factory method to obtain a new DOM Document object</p>
            * @argument sUri the namespace of the root node (if any)
            * @argument sUri the local name of the root node (if any)
            * @returns a new DOM Document
            */
            Sarissa.getDomDocument = function(sUri, sName){
                var oDoc = document.implementation.createDocument(sUri?sUri:null, sName?sName:null, null);
                return oDoc;
            };
        }
        else {
            Sarissa.getDomDocument = function(sUri, sName){
                var oDoc = document.implementation.createDocument(sUri?sUri:null, sName?sName:null, null);
                // looks like safari does not create the root element for some unknown reason
                if(oDoc && (sUri || sName) && !oDoc.documentElement){
                    oDoc.appendChild(oDoc.createElementNS(sUri, sName));
                };
                return oDoc;
            };
        };
    };//if(_SARISSA_HAS_DOM_CREATE_DOCUMENT)
};
//==========================================
// Common stuff
//==========================================
if(!window.DOMParser){
    if(_SARISSA_IS_SAFARI){
        /*
         * DOMParser is a utility class, used to construct DOMDocuments from XML strings
         * @constructor
         */
        DOMParser = function() { };
        /**
        * Construct a new DOM Document from the given XMLstring
        * @param sXml the given XML string
        * @param contentType the content type of the document the given string represents (one of text/xml, application/xml, application/xhtml+xml).
        * @return a new DOM Document from the given XML string
        */
        DOMParser.prototype.parseFromString = function(sXml, contentType){
            var xmlhttp = new XMLHttpRequest();
            xmlhttp.open("GET", "data:text/xml;charset=utf-8," + encodeURIComponent(sXml), false);
            xmlhttp.send(null);
            return xmlhttp.responseXML;
        };
    }else if(Sarissa.getDomDocument && Sarissa.getDomDocument() && Sarissa.getDomDocument(null, "bar").xml){
        DOMParser = function() { };
        DOMParser.prototype.parseFromString = function(sXml, contentType){
            var doc = Sarissa.getDomDocument();
            doc.loadXML(sXml);
            return doc;
        };
    };
};

if((typeof(document.importNode) == "undefined") && _SARISSA_IS_IE){
    try{
        /**
        * Implementation of importNode for the context window document in IE.
        * If <code>oNode</code> is a TextNode, <code>bChildren</code> is ignored.
        * @param oNode the Node to import
        * @param bChildren whether to include the children of oNode
        * @returns the imported node for further use
        */
        document.importNode = function(oNode, bChildren){
            var tmp;
            if (oNode.nodeName=='#text') {
                return document.createTextElement(oNode.data);
            }
            else {
                if(oNode.nodeName == "tbody" || oNode.nodeName == "tr"){
                    tmp = document.createElement("table");
                }
                else if(oNode.nodeName == "td"){
                    tmp = document.createElement("tr");
                }
                else if(oNode.nodeName == "option"){
                    tmp = document.createElement("select");
                }
                else{
                    tmp = document.createElement("div");
                };
                if(bChildren){
                    tmp.innerHTML = oNode.xml ? oNode.xml : oNode.outerHTML;
                }else{
                    tmp.innerHTML = oNode.xml ? oNode.cloneNode(false).xml : oNode.cloneNode(false).outerHTML;
                };
                return tmp.getElementsByTagName("*")[0];
            };
           
        };
    }catch(e){ };
};
if(!Sarissa.getParseErrorText){
    /**
     * <p>Returns a human readable description of the parsing error. Usefull
     * for debugging. Tip: append the returned error string in a <pre>
     * element if you want to render it.</p>
     * <p>Many thanks to Christian Stocker for the initial patch.</p>
     * @argument oDoc The target DOM document
     * @returns The parsing error description of the target Document in
     *          human readable form (preformated text)
     */
    Sarissa.getParseErrorText = function (oDoc){
        var parseErrorText = Sarissa.PARSED_OK;
        if(!oDoc.documentElement){
            parseErrorText = Sarissa.PARSED_EMPTY;
        } else if(oDoc.documentElement.tagName == "parsererror"){
            parseErrorText = oDoc.documentElement.firstChild.data;
            parseErrorText += "\n" +  oDoc.documentElement.firstChild.nextSibling.firstChild.data;
        } else if(oDoc.getElementsByTagName("parsererror").length > 0){
            var parsererror = oDoc.getElementsByTagName("parsererror")[0];
            parseErrorText = Sarissa.getText(parsererror, true)+"\n";
        } else if(oDoc.parseError && oDoc.parseError.errorCode != 0){
            parseErrorText = Sarissa.PARSED_UNKNOWN_ERROR;
        };
        return parseErrorText;
    };
};
Sarissa.getText = function(oNode, deep){
    var s = "";
    var nodes = oNode.childNodes;
    for(var i=0; i < nodes.length; i++){
        var node = nodes[i];
        var nodeType = node.nodeType;
        if(nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE){
            s += node.data;
        } else if(deep == true
                    && (nodeType == Node.ELEMENT_NODE
                        || nodeType == Node.DOCUMENT_NODE
                        || nodeType == Node.DOCUMENT_FRAGMENT_NODE)){
            s += Sarissa.getText(node, true);
        };
    };
    return s;
};
if(!window.XMLSerializer
    && Sarissa.getDomDocument
    && Sarissa.getDomDocument("","foo", null).xml){
    /**
     * Utility class to serialize DOM Node objects to XML strings
     * @constructor
     */
    XMLSerializer = function(){};
    /**
     * Serialize the given DOM Node to an XML string
     * @param oNode the DOM Node to serialize
     */
    XMLSerializer.prototype.serializeToString = function(oNode) {
        return oNode.xml;
    };
};

/**
 * strips tags from a markup string
 */
Sarissa.stripTags = function (s) {
    return s.replace(/<[^>]+>/g,"");
};
/**
 * <p>Deletes all child nodes of the given node</p>
 * @argument oNode the Node to empty
 */
Sarissa.clearChildNodes = function(oNode) {
    // need to check for firstChild due to opera 8 bug with hasChildNodes
    while(oNode.firstChild) {
        oNode.removeChild(oNode.firstChild);
    };
};
/**
 * <p> Copies the childNodes of nodeFrom to nodeTo</p>
 * <p> <b>Note:</b> The second object's original content is deleted before
 * the copy operation, unless you supply a true third parameter</p>
 * @argument nodeFrom the Node to copy the childNodes from
 * @argument nodeTo the Node to copy the childNodes to
 * @argument bPreserveExisting whether to preserve the original content of nodeTo, default is false
 */
Sarissa.copyChildNodes = function(nodeFrom, nodeTo, bPreserveExisting) {
    if(_SARISSA_IS_SAFARI && nodeTo.nodeType == Node.DOCUMENT_NODE){ // SAFARI_OLD ??
        nodeTo = nodeTo.documentElement; //Appearantly there's a bug in safari where you can't appendChild to a document node
    }
   
    if((!nodeFrom) || (!nodeTo)){
        throw "Both source and destination nodes must be provided";
    };
    if(!bPreserveExisting){
        Sarissa.clearChildNodes(nodeTo);
    };
    var ownerDoc = nodeTo.nodeType == Node.DOCUMENT_NODE ? nodeTo : nodeTo.ownerDocument;
    var nodes = nodeFrom.childNodes;
    if(typeof(ownerDoc.importNode) != "undefined")  {
        for(var i=0;i < nodes.length;i++) {
            nodeTo.appendChild(ownerDoc.importNode(nodes[i], true));
        };
    } else {
        for(var i=0;i < nodes.length;i++) {
            nodeTo.appendChild(nodes[i].cloneNode(true));
        };
    };
};

/**
 * <p> Moves the childNodes of nodeFrom to nodeTo</p>
 * <p> <b>Note:</b> The second object's original content is deleted before
 * the move operation, unless you supply a true third parameter</p>
 * @argument nodeFrom the Node to copy the childNodes from
 * @argument nodeTo the Node to copy the childNodes to
 * @argument bPreserveExisting whether to preserve the original content of nodeTo, default is
 */
Sarissa.moveChildNodes = function(nodeFrom, nodeTo, bPreserveExisting) {
    if((!nodeFrom) || (!nodeTo)){
        throw "Both source and destination nodes must be provided";
    };
    if(!bPreserveExisting){
        Sarissa.clearChildNodes(nodeTo);
    };
    var nodes = nodeFrom.childNodes;
    // if within the same doc, just move, else copy and delete
    if(nodeFrom.ownerDocument == nodeTo.ownerDocument){
        while(nodeFrom.firstChild){
            nodeTo.appendChild(nodeFrom.firstChild);
        };
    } else {
        var ownerDoc = nodeTo.nodeType == Node.DOCUMENT_NODE ? nodeTo : nodeTo.ownerDocument;
        if(typeof(ownerDoc.importNode) != "undefined") {
           for(var i=0;i < nodes.length;i++) {
               nodeTo.appendChild(ownerDoc.importNode(nodes[i], true));
           };
        }else{
           for(var i=0;i < nodes.length;i++) {
               nodeTo.appendChild(nodes[i].cloneNode(true));
           };
        };
        Sarissa.clearChildNodes(nodeFrom);
    };
};

/**
 * <p>Serialize any <strong>non</strong> DOM object to an XML string. All properties are serialized using the property name
 * as the XML element name. Array elements are rendered as <code>array-item</code> elements,
 * using their index/key as the value of the <code>key</code> attribute.</p>
 * @argument anyObject the object to serialize
 * @argument objectName a name for that object
 * @return the XML serialization of the given object as a string
 */
Sarissa.xmlize = function(anyObject, objectName, indentSpace){
    indentSpace = indentSpace?indentSpace:'';
    var s = indentSpace  + '<' + objectName + '>';
    var isLeaf = false;
    if(!(anyObject instanceof Object) || anyObject instanceof Number || anyObject instanceof String
        || anyObject instanceof Boolean || anyObject instanceof Date){
        s += Sarissa.escape(""+anyObject);
        isLeaf = true;
    }else{
        s += "\n";
        var isArrayItem = anyObject instanceof Array;
        for(var name in anyObject){
            s += Sarissa.xmlize(anyObject[name], (isArrayItem?"array-item key=\""+name+"\"":name), indentSpace + "   ");
        };
        s += indentSpace;
    };
    return (s += (objectName.indexOf(' ')!=-1?"</array-item>\n":"</" + objectName + ">\n"));
};

/**
 * Escape the given string chacters that correspond to the five predefined XML entities
 * @param sXml the string to escape
 */
Sarissa.escape = function(sXml){
    return sXml.replace(/&/g, "&")
        .replace(/</g, "&lt;")
        .replace(/>/g, ">")
        .replace(/"/g, '"')
        .replace(/'/g, "&apos;");
};

/**
 * Unescape the given string. This turns the occurences of the predefined XML
 * entities to become the characters they represent correspond to the five predefined XML entities
 * @param sXml the string to unescape
 */
Sarissa.unescape = function(sXml){
    return sXml.replace(/&apos;/g,"'")
        .replace(/"/g,"\"")
        .replace(/>/g,">")
        .replace(/</g,"<")
        .replace(/&/g,"&");
};
//   EOF
//--></script>
    <!-- <script type="text/javascript" src="sarissa/sarissa_ieemu_xpath.js"></script> -->
    <script type="text/javascript"><!--

    /**
 * ====================================================================
 * About
 * ====================================================================
 * Sarissa cross browser XML library - IE XPath Emulation
 * @version ${project.version}
 * @author: Copyright 2004-2007 Emmanouil Batsis, mailto: mbatsis at users full stop sourceforge full stop net
 *
 * This script emulates Internet Explorer's selectNodes and selectSingleNode
 * for Mozilla. Associating namespace prefixes with URIs for your XPath queries
 * is easy with IE's setProperty.
 * USers may also map a namespace prefix to a default (unprefixed) namespace in the
 * source document with Sarissa.setXpathNamespaces
 *
 * ====================================================================
 * Licence
 * ====================================================================
 * Sarissa is free software distributed under the GNU GPL version 2 (see <a href="../../sarissa/sarissa/gpl.txt">gpl.txt</a>) or higher,
 * GNU LGPL version 2.1 (see <a href="../../sarissa/sarissa/lgpl.txt">lgpl.txt</a>) or higher and Apache Software License 2.0 or higher
 * (see <a href="../../sarissa/sarissa/asl.txt">asl.txt</a>). This means you can choose one of the three and use that if you like. If
 * you make modifications under the ASL, i would appreciate it if you submitted those.
 * In case your copy of Sarissa does not include the license texts, you may find
 * them online in various formats at <a href="http://www.gnu.org">http://www.gnu.org</a> and
 * <a href="http://www.apache.org">http://www.apache.org</a>.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
 * KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
 * WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE
 * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
if(_SARISSA_HAS_DOM_FEATURE && document.implementation.hasFeature("XPath", "3.0")){
    /**
    * <p>SarissaNodeList behaves as a NodeList but is only used as a result to <code>selectNodes</code>,
    * so it also has some properties IEs proprietery object features.</p>
    * @private
    * @constructor
    * @argument i the (initial) list size
    */
    function SarissaNodeList(i){
        this.length = i;
    };
    /** <p>Set an Array as the prototype object</p> */
    SarissaNodeList.prototype = new Array(0);
    /** <p>Inherit the Array constructor </p> */
    SarissaNodeList.prototype.constructor = Array;
    /**
    * <p>Returns the node at the specified index or null if the given index
    * is greater than the list size or less than zero </p>
    * <p><b>Note</b> that in ECMAScript you can also use the square-bracket
    * array notation instead of calling <code>item</code>
    * @argument i the index of the member to return
    * @returns the member corresponding to the given index
    */
    SarissaNodeList.prototype.item = function(i) {
        return (i < 0 || i >= this.length)?null:this[i];
    };
    /**
    * <p>Emulate IE's expr property
    * (Here the SarissaNodeList object is given as the result of selectNodes).</p>
    * @returns the XPath expression passed to selectNodes that resulted in
    *          this SarissaNodeList
    */
    SarissaNodeList.prototype.expr = "";
    /** dummy, used to accept IE's stuff without throwing errors */
    if(window.XMLDocument && (!XMLDocument.prototype.setProperty)){
        XMLDocument.prototype.setProperty  = function(x,y){};
    };
    /**
    * <p>Programmatically control namespace URI/prefix mappings for XPath
    * queries.</p>
    * <p>This method comes especially handy when used to apply XPath queries
    * on XML documents with a default namespace, as there is no other way
    * of mapping that to a prefix.</p>
    * <p>Using no namespace prefix in DOM Level 3 XPath queries, implies you
    * are looking for elements in the null namespace. If you need to look
    * for nodes in the default namespace, you need to map a prefix to it
    * first like:</p>
    * <pre>Sarissa.setXpathNamespaces(oDoc, "xmlns:myprefix=&aposhttp://mynsURI&apos");</pre>
    * <p><b>Note 1 </b>: Use this method only if the source document features
    * a default namespace (without a prefix), otherwise just use IE's setProperty
    * (moz will rezolve non-default namespaces by itself). You will need to map that
    * namespace to a prefix for queries to work.</p>
    * <p><b>Note 2 </b>: This method calls IE's setProperty method to set the
    * appropriate namespace-prefix mappings, so you dont have to do that.</p>
    * @param oDoc The target XMLDocument to set the namespace mappings for.
    * @param sNsSet A whilespace-seperated list of namespace declarations as
    *            those would appear in an XML document. E.g.:
    *            <code>"xmlns:xhtml=&apos;http://www.w3.org/1999/xhtml&apos;
    * xmlns:&apos;http://www.w3.org/1999/XSL/Transform&apos;"</code>
    * @throws An error if the format of the given namespace declarations is bad.
    */
    Sarissa.setXpathNamespaces = function(oDoc, sNsSet) {
        //oDoc._sarissa_setXpathNamespaces(sNsSet);
        oDoc._sarissa_useCustomResolver = true;
        var namespaces = sNsSet.indexOf(" ")>-1?sNsSet.split(" "):new Array(sNsSet);
        oDoc._sarissa_xpathNamespaces = new Array(namespaces.length);
        for(var i=0;i < namespaces.length;i++){
            var ns = namespaces[i];
            var colonPos = ns.indexOf(":");
            var assignPos = ns.indexOf("=");
            if(colonPos > 0 && assignPos > colonPos+1){
                var prefix = ns.substring(colonPos+1, assignPos);
                var uri = ns.substring(assignPos+2, ns.length-1);
                oDoc._sarissa_xpathNamespaces[prefix] = uri;
            }else{
                throw "Bad format on namespace declaration(s) given";
            };
        };
    };
    /**
    * @private Flag to control whether a custom namespace resolver should
    *          be used, set to true by Sarissa.setXpathNamespaces
    */
    XMLDocument.prototype._sarissa_useCustomResolver = false;
    /** @private */
    XMLDocument.prototype._sarissa_xpathNamespaces = new Array();
    /**
    * <p>Extends the XMLDocument to emulate IE's selectNodes.</p>
    * @argument sExpr the XPath expression to use
    * @argument contextNode this is for internal use only by the same
    *           method when called on Elements
    * @returns the result of the XPath search as a SarissaNodeList
    * @throws An error if no namespace URI is found for the given prefix.
    */
    XMLDocument.prototype.selectNodes = function(sExpr, contextNode, returnSingle){
        var nsDoc = this;
        var nsresolver = this._sarissa_useCustomResolver
        ? function(prefix){
            var s = nsDoc._sarissa_xpathNamespaces[prefix];
            if(s)return s;
            else throw "No namespace URI found for prefix: '" + prefix+"'";
            }
        : this.createNSResolver(this.documentElement);
        var result = null;
        if(!returnSingle){
            var oResult = this.evaluate(sExpr,
                (contextNode?contextNode:this),
                nsresolver,
                XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
            var nodeList = new SarissaNodeList(oResult.snapshotLength);
            nodeList.expr = sExpr;
            for(var i=0;i<nodeList.length;i++)
                nodeList[i] = oResult.snapshotItem(i);
            result = nodeList;
        }
        else {
            result = oResult = this.evaluate(sExpr,
                (contextNode?contextNode:this),
                nsresolver,
                XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
        };
        return result;      
    };
    /**
    * p>Extends the Element to emulate IE's selectNodes</p>
    * @argument sExpr the XPath expression to use
    * @returns the result of the XPath search as an (Sarissa)NodeList
    * @throws An
    *             error if invoked on an HTML Element as this is only be
    *             available to XML Elements.
    */
    Element.prototype.selectNodes = function(sExpr){
        var doc = this.ownerDocument;
        if(doc.selectNodes)
            return doc.selectNodes(sExpr, this);
        else
            throw "Method selectNodes is only supported by XML Elements";
    };
    /**
    * <p>Extends the XMLDocument to emulate IE's selectSingleNode.</p>
    * @argument sExpr the XPath expression to use
    * @argument contextNode this is for internal use only by the same
    *           method when called on Elements
    * @returns the result of the XPath search as an (Sarissa)NodeList
    */
    XMLDocument.prototype.selectSingleNode = function(sExpr, contextNode){
        var ctx = contextNode?contextNode:null;
        return this.selectNodes(sExpr, ctx, true);
    };
    /**
    * <p>Extends the Element to emulate IE's selectSingleNode.</p>
    * @argument sExpr the XPath expression to use
    * @returns the result of the XPath search as an (Sarissa)NodeList
    * @throws An error if invoked on an HTML Element as this is only be
    *             available to XML Elements.
    */
    Element.prototype.selectSingleNode = function(sExpr){
        var doc = this.ownerDocument;
        if(doc.selectSingleNode)
            return doc.selectSingleNode(sExpr, this);
        else
            throw "Method selectNodes is only supported by XML Elements";
    };
    Sarissa.IS_ENABLED_SELECT_NODES = true;
};

//--></script>
    <script type="text/javascript">
      <!--
      var oXmlDoc;
      //var oXslDoc;
      var showCounter = 10;

      function init()
            {
        // create the xml document object
        oXmlDoc = Sarissa.getDomDocument();
        oXmlDoc.async = false;
        oXmlDoc.load("http://www.webtasticdesigns.co.uk/testarea/xml/bloglist/bloglist.xml");

        // create the xsl document objects
        oXslDropDownDoc = Sarissa.getDomDocument();
        oXslDropDownDoc.async = false;
        oXslDropDownDoc.load("http://www.webtasticdesigns.co.uk/testarea/xml/bloglist/dropDown.xsl");
        showDropDown(oXslDropDownDoc);

/*
        oXslNavL1Doc = Sarissa.getDomDocument();
        oXslNavL1Doc.async = false;
        oXslNavL1Doc.load("http://www.webtasticdesigns.co.uk/testarea/xml/bloglist/navL1.xsl");
        showNavL1(oXslNavL1Doc);

        oXslImgDoc = Sarissa.getDomDocument();
        oXslImgDoc.async = false;
        oXslImgDoc.load("http://www.webtasticdesigns.co.uk/testarea/xml/bloglist/imageLinkSet.xsl");
        showImageLinkSet(oXslImgDoc);
*/
        }
            
      function showDropDown(oXslDoc)
      {
        var xsltProc  = new XSLTProcessor();
        xsltProc.importStylesheet(oXslDoc);
        var resFrag = xsltProc.transformToDocument(oXmlDoc);
        document.getElementById("dropDown").innerHTML = new XMLSerializer().serializeToString(resFrag);
      }

      function showNavL1(oXslDoc)
      {
        var xsltProc  = new XSLTProcessor();
        xsltProc.importStylesheet(oXslDoc);
        xsltProc.setParameter(null, 'cat' , 'Sport');
        var resFrag = xsltProc.transformToDocument(oXmlDoc);
        document.getElementById("navL1").innerHTML = new XMLSerializer().serializeToString(resFrag);
      }
        
        function showImageLinkSet(oXslDoc)
      {
        var xsltProc  = new XSLTProcessor();
        xsltProc.importStylesheet(oXslDoc);
        xsltProc.setParameter(null, 'cat' , 'Sport');
        var resFrag = xsltProc.transformToDocument(oXmlDoc);
        document.getElementById("imageLinkSet").innerHTML = new XMLSerializer().serializeToString(resFrag);
      }
     
      //-->
    </script>
</head>

<body onload="init();" class="Sport">

  <div id="dropDown"></div>
   <div id="navL1"></div>

  <div id="imageLinkSet"></div>

</body>
</html>
0
 
hieloCommented:
It would be nice if you could repost navL1.xsl and imageLinkSet.xsl
0
 
Geert BormansCommented:
I made a typo, you must have had the right version
I am using
@version 0.9.7.6
myself
make sure your sarissa has a version tag and not a placeholder

I was out for an hour and seemed to have missed some of the action,
what is the status now, do you see some things going on?

@hielo,
why are you pasting in the sarissa, instead of refering to it, doesn't seem really nice this way
did you make changes,
if the current sarissa has bugs, would it not be better to point to an older one?

you need to get rid of some legacy from my earliest example
onclick="clearMetaSelector()" needs to be remved from the html or body tag
you can also delete
    var showCounter = 10;
and I would add a var objectname for all three of the xsl objects

cheers

Geert
0
 
Lady_MAuthor Commented:
Hi hielo

I thought I was on my own now so I took it down.

I think I have Sarissa working now.  My problems are mainly with the XSLT formatting really.  

I've decided to simplify things for the time-being and just try to get one XSLT working.  
http://www.webtasticdesigns.co.uk/testarea/xml/bloglist/test.htm

I don't know XSLT and I'm trying to work out the syntax at the moment, but you may be able to save me alot of hassle.

Basically in pseudo code, what I want to output into <div id="dropDown">  is this:
<ul class="dropdownnav">
    <li>CATEGORY @NAME
          <ul>
                 <li><a href="BLOGURL">BLOGTITLE:  <img src="IMAGEPATH" alt="IMAGEALT" /></a></li>
           </ul>
      </li>
</ul>
0
 
Lady_MAuthor Commented:
Do I need to download an older version of Sarissa?

I removed the onclick="clearMetaSelector()"  already, I didn't think that was doing anything.
0
 
Geert BormansCommented:
if the one you are using is working, you can stick to that one
I am very happy with the one I mentioned last
and have not encountered bugs with that one
I don't like to break working applications by upgrading, so I sticked to that version as long as I dd not fully test the newer ones
I can send the two files you need in an email if you want to
0
 
hieloCommented:
On your test.html file I see "Drop Down Nav"
Yes, I debugged the Sarissa Library. If you notice there are three script tags two for Sarissa and yours.
The inline Sarissa files should replace the ones you downloaded. Lets get this going. I can help you with Javascript, XML, XSL, HTML, but goodness sake, lets establish the mission and accomplish it. If you keep changing the files we are going to get nowhere.
0
 
Geert BormansCommented:
Can you show me what the XML is that you want with that XSLT?
0
 
Lady_MAuthor Commented:
Sorry, sorry guys.  No,

what I want to output into <div id="dropDown"></div> is this:
<ul class="dropdownnav">
    <li class="CATEGORY @NAME">CATEGORYIMAGE
          <ul>
                 <li><a href="BLOGURL">BLOGTITLE</li>
           </ul>
      </li>
</ul>

==============================================
And into <div id="navL1"></div> is this:


WHERE CATEGORY @NAME == body.className
<ul>
       <li><a href="BLOGURL">BLOGTITLE</li>
</ul>

===========================================
And into <div id="imageLinkSet"></div>  is this:


WHERE CATEGORY @NAME == body.className
<ul>
       <li><a href="BLOGURL"><img src="BLOGIMAGE/BLOGIMAGEPATH" alt="BLOGIMAGE/BLOGIMAGEALT" /></a></li>
</ul>
0
 
hieloCommented:
Thank you. Stand by...
0
 
Lady_MAuthor Commented:
Okay. Agreed.  I'm not changing any files at the moment.  Haven't touched them since we started talking again.

I think I need to get the versions of the Sarissa files that you have Gertone.  Could you post them to me please?

hielo. I was mid testing something else when I checked back in to see if there were any replies.   I thought everyone had gone to bed.  Do you want me to put all the old versions of the html and xslt back up?
0
 
Geert BormansCommented:
here is the first one

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:template match="/">
        <ul class="dropdownnav">
           
            <xsl:apply-templates select="//CATEGORY" />
        </ul>
    </xsl:template>
    <xsl:template match="CATEGORY">
        <li class="{@NAME}"><xsl:value-of select="CATEGORYIMAGE"/>
            <ul>
                <xsl:apply-templates select="BLOG" />
            </ul>
        </li>
    </xsl:template>
    <xsl:template match="BLOG">
        <li>
            <a href="{BLOGURL}"><xsl:value-of select="BLOGTITLE"/></a>
        </li>
    </xsl:template>
</xsl:stylesheet>
0
 
Geert BormansCommented:
for the second you need to pass the parameter

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:param name="cat"/>
    <xsl:template match="/">
        <ul>
           
            <xsl:apply-templates select="//CATEGORY[@NAME = $cat]//BLOG" />
        </ul>
    </xsl:template>
    <xsl:template match="BLOG">
        <li>
            <a href="{BLOGURL}"><xsl:value-of select="BLOGTITLE"/></a>
        </li>
    </xsl:template>
</xsl:stylesheet>
0
 
Geert BormansCommented:
and the third,
with the parameter again,

I assume you changed SITEURL to BLOGURL and the likes

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:param name="cat"/>
    <xsl:template match="/">
        <ul>
            <xsl:apply-templates select="//CATEGORY[@NAME = $cat]//BLOG" />
        </ul>
    </xsl:template>
    <xsl:template match="BLOG">
        <li>
            <a href="{BLOGURL}"><img src="{BLOGIMAGE/BLOGIMAGEPATH}" alt="{BLOGIMAGE/BLOGIMAGEALT}" /></a>
        </li>
    </xsl:template>
</xsl:stylesheet>

if you post me an email address, I will prepare the files for you
(if you don't want to post, you can find my email address in my profile)

cheers

Geert
0
 
Lady_MAuthor Commented:
Hey Geert, I had a look at your profile and I can't see your email address.  But I'm tired and can't see too straight, so...
I don't mind you guys having mine, but I don't much want to post it here if possible.

Okay I will set up a second folder and put those XSLT files in it so I don't muck up the ones hielo is looking at.  Will post a link shortly.

Thanks both of you.  I really appreciate this.  I hope you are okay doing this, and don't have to be up at the crack of dawn.  

0
 
Geert BormansCommented:
at the end of my profile, look for
"For more detail..."
on that line, you will find an email with @ and . replaced by a no-spam thingy
0
 
hieloCommented:
This wireless connection is killing me. I apologize if you see double posts: Here is the first one:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
     <xsl:template match="/">
                        <xsl:for-each select="CATEGORIES/CATEGORY">
                              <ul class="dropdownnav">
                                    <li class="{@NAME}"><xsl:apply-templates select="."/></li>
                              </ul>
                        </xsl:for-each>
    </xsl:template>
      <xsl:template match="CATEGORY">
            <img src="{CATEGORYIMAGE}" alt="" />
            <ul>
                  <xsl:for-each select="BLOGS/BLOG">
                        <li><a href="{BLOGURL}"><xsl:value-of select="BLOGTITLE"/></a></li>
                  </xsl:for-each>
            </ul>
      </xsl:template>

</xsl:stylesheet>
0
 
Lady_MAuthor Commented:
I found it Geert, and sent you a mail.
0
 
hieloCommented:
Here are the three XSL files in a single post. You need to save them separately.
<!-- first -->
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
     <xsl:template match="/">
                        <xsl:for-each select="CATEGORIES/CATEGORY">
                              <ul class="dropdownnav">
                                    <li class="{@NAME}"><xsl:apply-templates select="."/></li>
                              </ul>
                        </xsl:for-each>
    </xsl:template>
      <xsl:template match="CATEGORY">
            <img src="{CATEGORYIMAGE}" alt="" />
            <ul>
                  <xsl:for-each select="BLOGS/BLOG">
                        <li><a href="{BLOGURL}"><xsl:value-of select="BLOGTITLE"/></a></li>
                  </xsl:for-each>
            </ul>
      </xsl:template>

</xsl:stylesheet>


<!-- second NOTE: I set the default category to "Sport" but you can change it to an empty string -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:param name="cat" select="'Sport'"/>
    <xsl:template match="/">
                <xsl:choose>
            <xsl:when test="not($cat='')">
        <ul>
           
            <xsl:apply-templates select="//CATEGORIES/CATEGORY[@NAME = $cat]//BLOG" />
        </ul>
         </xsl:when>
            <xsl:otherwise>
                  <div>No Category was specified</div>
            </xsl:otherwise>
         </xsl:choose>
    </xsl:template>

    <xsl:template match="BLOG">
        <li>
            <a href="{BLOGURL}"><xsl:value-of select="BLOGTITLE"/></a>
        </li>
    </xsl:template>
</xsl:stylesheet>



<!-- Third NOTE: I set the default category to "Sport" but you can change it to an empty string -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:param name="cat" select="'Sport'"/>
    <xsl:template match="/">
                <xsl:choose>
            <xsl:when test="not($cat='')">
                    <ul>
                  <xsl:apply-templates select="//CATEGORIES/CATEGORY[@NAME = $cat]//BLOG" />
                    </ul>
            </xsl:when>
            <xsl:otherwise>
                  <div>No Category was specified</div>
            </xsl:otherwise>
         </xsl:choose>
    </xsl:template>
    <xsl:template match="BLOG">
        <li>
            <a href="{BLOGURL}"><img src="{BLOGIMAGE/BLOGIMAGEPATH}" alt="{BLOGIMAGE/BLOGIMAGEALT}" /></a>
        </li>
    </xsl:template>
</xsl:stylesheet>
 
0
 
Lady_MAuthor Commented:
Thanks hielo!
I have uploaded them to another folder to keep your and Geert's files separate:

http://www.webtasticdesigns.co.uk/testarea/xml/hielo/test.htm
0
 
Geert BormansCommented:
Lady_M,

Can you strip the DTD from the XML file?
I tested the small test file you have on the server,
and it works if I strip the DTD from the XML file,
allthough the file is completely valid, Sarissa does not respond very well to it
(some browsers don't validate and you force some others in validating mode,
I have to check why Sarissa has difficulties with it, but if you simply strip the DTD it will work)

I see that hielo comes up with more or less the same XSLTs as I posted a while ago, so you will be fine in that region

cheers

Geert
0
 
Lady_MAuthor Commented:
Okay so I'm looking at it now and have a few questions:

I'm still a bit confused about this  <xsl:param name="cat" select="'Sport'"/> line.  Obviously the category is a variable and won't necessarily be sport.  I'm not sure how I go about passing this parameter in to the XSLT.  I will figure it out I'm sure.

The drop-down one doesn't seem to be outputting anything.  Can you see the issue?

Thank you
0
 
hieloCommented:
Since you placed my files on a separate folder, can you rename hielo/Sarissa/sarissa.js to hielo/Sarissa/sarissaBk.js and create a new sarissa.js from the one I posted previously. I am not seeing any output on IE, but I see results in FF for http://www.webtasticdesigns.co.uk/testarea/xml/hielo/test.htm
0
 
Lady_MAuthor Commented:
Hi Gertone
Okay took the DTD out:
http://www.webtasticdesigns.co.uk/testarea/xml/gertone/test.htm


I'll keep the test2 folder for me to play with.
0
 
hieloCommented:
IF no parameter is passed it will default to "Sport". You can set it to a blank string if you like.
0
 
Geert BormansCommented:
hielo,
that is because FireFox ignores the DTD and IE doesn't
stripping the DTD makes it work for both
0
 
hieloCommented:
OK. if the DTD is the problem then perhaps no need to replace the sarissa files.
0
 
Lady_MAuthor Commented:
Hi hielo
Okay I've replaced the Sarissa.js file with the first half of that code you posted.  Not sure if that was the section you meant.
But I see output in IE6.  
0
 
hieloCommented:
"my" test page comes up blank. Did you remove the DTD from bloglist.xml file in "my" directory?
0
 
Lady_MAuthor Commented:
<quote>
IF no parameter is passed it will default to "Sport". You can set it to a blank string if you like.
</quote>
But how do I actually pass the parameter in?  Just as a function (variable)?
I haven't had a chance to look at the code yet.  Too busy making files and folders.  So maybe it's obvious if I look.
0
 
Lady_MAuthor Commented:
okay DTDs gone in both.  But I see data in IE 6.
0
 
Lady_MAuthor Commented:
Hmm, removing the DTDs causes a Javascript error in IE6:  "Sarissa is undefined"
0
 
Geert BormansCommented:
This sets the parameter
      xsltProc.setParameter('', 'cat' , 'Sport');
You need to give that the value of the body class
0
 
hieloCommented:
Try:
      function showNavL1()
      {
        var xsltProc  = new XSLTProcessor();
        xsltProc.importStylesheet(oXslNavL1Doc);
        xsltProc.setParameter(null, 'cat' , 'Fashion');
        var resFrag = xsltProc.transformToDocument(oXmlDoc);
        document.getElementById("navL1").innerHTML = new XMLSerializer().serializeToString(resFrag);
      }
      function showImageLinkSet()
      {
        var xsltProc  = new XSLTProcessor();
        xsltProc.importStylesheet(oXslImageLinkSetDoc);
        xsltProc.setParameter(null, 'cat' , 'Fashion');
        var resFrag = xsltProc.transformToDocument(oXmlDoc);
        document.getElementById("imageLinkSet").innerHTML = new XMLSerializer().serializeToString(resFrag);
      }
0
 
hieloCommented:
This is only happening on "my" test file because the Sarissa file that you created contains non-javascript data. Specifically, in my original post I combined all the javascript into a single file.
The code that you pasted in Sarissa.js still contains the HTML script tags at the end. You need to remove them.
0
 
Lady_MAuthor Commented:
hielo
I have changed the functions.  Still getting the error in IE, Sarissa is undefined.

Gertone.
When you say that
xsltProc.setParameter('', 'cat' , 'Sport');
this sets the parameter. Presumably you mean this is hard-coding the value of category to "sport"?  I'm not familiar enough with the syntax to figure out what is going on with that.  You realise that the category could be sport/fashion/life/games or tech don't you?  I'm really not clear how to get that value and compare it in the function.

Sorry I'm tired, hard to concentrate.  And I'm sure you both are too.  Please don't feel obliged to work on this all night.
0
 
Lady_MAuthor Commented:
Yeah sorry hielo.  I did remove them, too many files open.  Okay removed the script stuff again.
0
 
Lady_MAuthor Commented:
Hi hielo
It's working in firefox isn't it.  But I don't know if you have IE6, but it just doesn't process the dropdown one at all in that.
0
 
Geert BormansCommented:
yes, I mean this is hardcoding 'sport'
if you replace it with one of the other 4 values, you will get a different result
this logic you will implement in javascript
0
 
Lady_MAuthor Commented:
Hi Gertone.  So basically I amend my show functions to grab that body.className and compare it to the CATEGORY @NAME - is that right?
And the XSLT stays the same as it is?

Okay got it.  Thank you.


Anyone have any idea why IE6 is throwing a fit?
0
 
Lady_MAuthor Commented:
Okay I forgot to ask.  Is it necessary to check if a value exists before outputting it in XSLT, or does it automatically ignore the empty ones?
0
 
hieloCommented:
Make sure there are no blank lines between these two lines in your XML file:

<?xml version="1.0" encoding="ISO-8859-1"?>
<CATEGORIES>

IE may be interpreting as "text" nodes
0
 
hieloCommented:
currently the xsl file has this:
<ul>
  <xsl:apply-templates select="//CATEGORIES/CATEGORY[@NAME = $cat]//BLOG" />
</ul>

the xsl engine will evaluate the expression within the select attribute. If nothing matches that category, no templates will be executed. In that situation your html output will be an empty unordered list:
<ul></ul>

I recommend one of the following two options:
a. I you do not want any message when a category does not match
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
      <xsl:param name="cat" select="'Sport'"/>
      <xsl:template match="/">
            <xsl:choose>
                  <xsl:when test="not($cat='')">
                        <xsl:if test="//CATEGORIES/CATEGORY[@NAME = $cat]/BLOG">
                              <ul>
                                    <xsl:apply-templates select="//CATEGORIES/CATEGORY[@NAME = $cat]/BLOG" />
                              </ul>
                        </xsl:if>
                  </xsl:when>

                  <xsl:otherwise>
                        <div>No Category was specified</div>
                  </xsl:otherwise>
               </xsl:choose>
      </xsl:template>

    <xsl:template match="BLOG">
        <li>
            <a href="{BLOGURL}"><xsl:value-of select="BLOGTITLE"/></a>
        </li>
    </xsl:template>
</xsl:stylesheet>

b. IF you want "<div>CATEGORY UNKNOWN</div>" returned when there is no match.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
      <xsl:param name="cat" select="'Sport'"/>
      <xsl:template match="/">
            <xsl:choose>
                  <xsl:when test="not($cat='')">
                        <xsl:choose>
                              <xsl:when test="//CATEGORIES/CATEGORY[@NAME = $cat]/BLOG">
                                    <ul>
                                          <xsl:apply-templates select="//CATEGORIES/CATEGORY[@NAME = $cat]/BLOG" />
                                    </ul>
                              </xsl:when>
                              <xsl:otherwise><div>UNKNOWN CATEGORY</div></xsl:othewise>
                        </xsl:choose>
                  </xsl:when>

                  <xsl:otherwise>
                        <div>No Category was specified</div>
                  </xsl:otherwise>
               </xsl:choose>
      </xsl:template>

    <xsl:template match="BLOG">
        <li>
            <a href="{BLOGURL}"><xsl:value-of select="BLOGTITLE"/></a>
        </li>
    </xsl:template>
</xsl:stylesheet>
0
 
Lady_MAuthor Commented:
I removed all the blank lines in my xml data file.  But IE6 still creates an error.  It is completely ignoring the first function output (dropdown).

In case you're confused, I have added another function to your test file hielo, called MailID.  The idea being to output the same list as drop-down but with the MailID value in a checkbox.  

Okay guys.  Listen I am going to call it a day for now.  I'm going to try again tomorrow morning early.  I feel bad keeping you up.

Thanks so! much for all your help.  You've both been brilliant and extremely kind.

Maybe speak tomorrow.

0
 
hieloCommented:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
     <xsl:template match="/">
                        <xsl:for-each select="CATEGORIES/CATEGORY">
                              <ul>
                                    <li><xsl:apply-templates select="."/></li>
                              </ul>
                        </xsl:for-each>
    </xsl:template>

      <xsl:template match="CATEGORY">
            <ul>
                        <li>
                              <h4>CATEGORY<xsl:value-of select="@NAME"/></h4>
                              <xsl:for-each select="BLOGS/BLOG">
                                    <li><input type="checkbox" name="AddressBookID"  id="{BLOGTITLE}" value="{MAILID}" /><label for="{BLOGTITLE}"><xsl:value-of select="BLOGTITLE"/></label></li>
                              </xsl:for-each>
                        </li>
            </ul>
      </xsl:template>

</xsl:stylesheet>
0
 
Geert BormansCommented:
Hi, I am back up now, ready to continue.
If you have further questions, I would recommend that you consolidate your current status
preferably in one track because two parallel threads is a very confusing communication

Maybe for the time being only test IE7 and FF; I seem to have read about IE6 issues
Today I have a pretty busy morning, but I can check out on IE6 later today if necessary
0
 
Geert BormansCommented:
Note that I always put some sort of fixed line in my XSLTs when I am still testing
to show during testing that the XSLT actually executes
0
 
Lady_MAuthor Commented:
Morning Gertone.
Morning Hielo if you're there as well.

Well I have updated a few things and created a single test folder now as you suggested:
http://www.webtasticdesigns.co.uk/testarea/xml/hielo/test.htm

I am working on the cat id thing at the moment.  

But as you can see only the dropDown XSLT is working right now.  There is some kind of javascript error since I put hielo's new lines in the other two to test for a category.
And I know you don't want to know about IE, but nothing is showing in that at all.

Another question:  as far as testing for empty values, some blogs won't have images or mailids, etc.  Will they just be skipped?  In Javascript I would expect to say if (MAILID != "") then output this line or if (IMAGEPATH != "") then output this line,  but I'm not sure how you do that in XSL.  Presumably it should happen in the function instead?

Also the hard-coded, non-XML versions of all these lists use CSS styles to turn them into drop-down navigations and all kinds of things.  Can I incorporate CSS styles into the XSLT files, if so, is it a case of just adding the CSS classes and IDs to the elements?  Or do I have to do it completely through XSLT?

Thanks

Also,
0
 
Lady_MAuthor Commented:
Sorry, the link to the new test area should have been:
http://www.webtasticdesigns.co.uk/testarea/xml/final/test.htm
0
 
Geert BormansCommented:
I see that the error message is that an XML document can only have one root element
Sarissa is tricky about XML wellformedness, so you have to make sure that the result of the XSLT is wellformed in all cases
0
 
Geert BormansCommented:
Try adding a div in the stylesheet (dropdown)
like this
     <xsl:template match="/">
     <div>
        <xsl:for-each select="CATEGORIES/CATEGORY">
              <ul class="dropdownnav">
                    <li class="{@NAME}"><xsl:apply-templates select="."/></li>
              </ul>
        </xsl:for-each>
     </div>
    </xsl:template>
this way you guarantuee that no matter how many CATEGORY elements you have
the resulting html will be wellformed XML

I looked at your XSLT dropdown.xsl
and that really is a proceduraly oriented beginners XSLT
I don't blame you for that of course, it is kind of exiting that you got here after just one day
but you should learn from the beginning not to use for-each too much
learn to push out your nodes to the templates, it makes a lot better readable code
the apply-templates select="." is a real maintenance killer... don't use it
No offence, but I rewrote the dropdown.xsl and I suggest you use that

 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
       <xsl:output indent="yes"/>
     <xsl:template match="/">
           <div>
                 <xsl:apply-templates select="CATEGORIES/CATEGORY" />
           </div>
    </xsl:template>
      <xsl:template match="CATEGORY">
                  <ul class="dropdownnav">
                        <li class="{@NAME}">
                              <img src="{CATEGORYIMAGE}" alt="" />
                              <ul>
                                    <xsl:apply-templates select="BLOGS/BLOG" />
                              </ul>
                        </li>
                  </ul>
      </xsl:template>
       <xsl:template match="BLOG">
             <li><a href="{BLOGURL}"><xsl:value-of select="BLOGTITLE"/></a></li>
       </xsl:template>
</xsl:stylesheet>

as you see I push out child nodes to the templates using apply templates
Don't go into this too deep today, you will praise me later if you need to change the XSLT in the future

I will now look at the other ones

cheers

Geert
0
 
Geert BormansCommented:
The next two XSLTs don't load because there is a typo in the closing tag for xsl:otherwise
The r is missing
If you correct that, you will be fine
0
 
Lady_MAuthor Commented:
Hi Gertone
Oh yes, I see that now thanks for spotting that.
Okay well more is happening, but I am getting two UNKNOWN CATEGORY s being output which I think refer to the imageLinkSet because that's not showing still.  
You know you said about adding a fixed line to show if the XSL is being executed, how do I do that?  It sounds helpful.

No offense taken to anything either of you suggest. Please don't give that a second thought!   I'm just extremely grateful you're both telling me how to do this.   I'm not taking any credit for any of this code anyway, It's a mashup of both of your's and a few little bits from me.
0
 
Geert BormansCommented:
The unknown category happens because BLOG i not a direct child of CATEGORY. Hence the test fails

Here is a corrected navL1.xsl

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
      <xsl:param name="cat" select="'Sport'"/>
      <xsl:output indent="yes"/>
      <xsl:template match="/">
            <div>
                  <span>I am here: NAVL1</span>
                  <xsl:choose>
                        <xsl:when test="not($cat='')">
                              <xsl:choose>
                                    <xsl:when test="/CATEGORIES/CATEGORY[@NAME = $cat]">
                                          <ul>
                                                <xsl:apply-templates select="/CATEGORIES/CATEGORY[@NAME = $cat]/BLOGS/BLOG" />
                                          </ul>
                                    </xsl:when>
                                    <xsl:otherwise><div>UNKNOWN CATEGORY</div></xsl:otherwise>
                              </xsl:choose>
                        </xsl:when>
                        <xsl:otherwise>
                              <div>No Category was specified</div>
                        </xsl:otherwise>
                  </xsl:choose>
            </div>
      </xsl:template>
    <xsl:template match="BLOG">
        <li>
            <a href="{BLOGURL}"><xsl:value-of select="BLOGTITLE"/></a>
        </li>
    </xsl:template>
</xsl:stylesheet>

note that I added a span "I am here"
This will always show up.
If you are done testing, remove the span
If it doesn't show, you know that the XSLT failed loading

cheers

Geert
0
 
Geert BormansCommented:
same operation on imageLinkSet.xsl

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
      <xsl:param name="cat" select="'Sport'"/>
      <xsl:template match="/">
            <div>
                  <span>I am here ImageLink</span>
                  <xsl:choose>
                        <xsl:when test="not($cat='')">
                              <xsl:choose>
                                    <xsl:when test="/CATEGORIES/CATEGORY[@NAME = $cat]/BLOGS/BLOG">
                                          <ul>
                                                <xsl:apply-templates select="//CATEGORIES/CATEGORY[@NAME = $cat]/BLOGS/BLOG" />
                                          </ul>
                                    </xsl:when>
                                    <xsl:otherwise><div>UNKNOWN CATEGORY</div></xsl:otherwise>
                              </xsl:choose>
                        </xsl:when>
                        <xsl:otherwise>
                              <div>No Category was specified</div>
                        </xsl:otherwise>
                  </xsl:choose>
            </div>
      </xsl:template>

    <xsl:template match="BLOG">
        <li>
            <a href="{BLOGURL}"><img src="{BLOGIMAGE/BLOGIMAGEPATH}" alt="{BLOGIMAGE/BLOGIMAGEALT}" /></a>
        </li>
    </xsl:template>
</xsl:stylesheet>

cheers

Geert
0
 
Geert BormansCommented:
Here is mailID.xsl

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
      <xsl:output indent="yes"/>
      <xsl:template match="/">
           <div>
                 <span>I am here: mailID</span>
                  <xsl:apply-templates select="/CATEGORIES/CATEGORY"/>
           </div>
    </xsl:template>

      <xsl:template match="CATEGORY">
            <ul>
                        <li>
                              <h4>
                                    <xsl:text>CATEGORY&#160;</xsl:text>
                                    <xsl:value-of select="@NAME"/>
                              </h4>
                              <ul>
                                    <xsl:apply-templates select="BLOGS/BLOG" />
                              </ul>
                        </li>
            </ul>
      </xsl:template>
 
      <xsl:template match="BLOG">
                  <li><input type="checkbox" name="AddressBookID"  id="{BLOGTITLE}" value="{MAILID}" /><label for="{BLOGTITLE}"><xsl:value-of select="BLOGTITLE"/></label></li>
      </xsl:template>

</xsl:stylesheet>
               
Here is what I did to it
- I added a div at the top level to avoid the IE error for multiple root nodes
- I added the I am here line
- I removed the spurious xsl:for-each and made the XSLT more XSLT programming style
- I added a non-breaking space between the word CATEGORY and the title
- I shuffled the UL a bit, hope this is OK, tell me if not

Let me know if you have other wishes

Geert
0
 
Geert BormansCommented:
I have another machine up now, with an IE6,
as soon as you have the files up, I can check on IE6
0
 
Lady_MAuthor Commented:
Hi Gertone.
I have updated all the files as you suggested.  Still a few issues.  I will go through and work them all out and post a list shortly.
Thanks
0
 
Lady_MAuthor Commented:
I'm not getting very far with the category variable.
The body tag passes it to the function:
<body onload="init("sport");">

The init function receives it:
 function init(cat) {
...}

The show function attempts  sets param:
        xsltProc.importStylesheet(oXslImageLinkSetDoc);
        xsltProc.setParameter("", 'cat' , cat);

And then the XSLT does something mysterious with it:
 <xsl:param name="cat" select="????????"/>

which it then uses to test against:
 <xsl:when test="//CATEGORIES/CATEGORY[@NAME = $cat]/BLOG">


That select needs to select something from the XML data doesn't it?  I don't understand how to assign the init(variable) to the $cat variable.







0
 
Geert BormansCommented:
      xsltProc.setParameter("", 'cat' , cat);
passes the variable cat as the parameter 'cat' to the stylesheet
and over writes the initial value of xsl:param in the XSLT

<xsl:param name="cat" select="????????"/>
should be
<xsl:param name="cat" />
if you add a select statement, you have a default value
I tend to leave that empty, so you are sure you don't make mistakes becauses of hidden defaults
I think hielo was confusing you here

> That select needs to select something from the XML data doesn't it?
that select is ignored if you pass something from the calling javascript function, which you do

<xsl:when test="//CATEGORIES/CATEGORY[@NAME = $cat]/BLOG">
should be
<xsl:when test="//CATEGORIES/CATEGORY[@NAME = $cat]/BLOGS/BLOG">

did you use al four of my XSLTs?
I corrected all four of them, so use those as a basis

cheers

Geert



0
 
Lady_MAuthor Commented:
Hi Gertone
I totally missed the other three xslt files you wrote sorry. okay I have them now.
Things are looking good.  In firefox great.  
In IE6 for MailID.xsl:  "The stylesheet does not contain a document element.  The stylesheet may be empty or it may not be a well-formed XML documente".  This presumably is a div thing again?

My final(ish) questions are these:
1) For some of the categories, I do not have a BLOGIMAGEPATH or BLOGIMAGEALT yet.
<BLOGIMAGE>
    <BLOGIMAGEPATH></BLOGIMAGEPATH>
    <BLOGIMAGEALT> </BLOGIMAGEALT>
</BLOGIMAGE>

I thought the best thing to do would be just to leave the <div id="imageLinkSet"> out of the template for the categories which don't have those yet.  That will be okay right?
I'm going to look up conditional syntax and try to understand that.

2) I would prefer not to have a body onLoad  so I added:
Event.observe(window, 'load', function(){init();} );
which isn't executing.  Is there a particular reason?  Or is it just a javascript issue?  If the latter I can sort this out.

3) My final question is a bit more complicated so I'll put it in another post.
0
 
hieloCommented:
Good Morning. Wow, you guys have been busy. I am getting an Event us undefined error in IE.
You can try changing
Event.observe(window, 'load', function(){init();} );
to simply
window.onload=init;
in global.js
0
 
hieloCommented:
It turns out that "Only one top level element is allowed" was being caused only two of the XSL file. Those with for-each! Changing those to apply-templates got every thing working in IE. Unfortunately I do not have your email addresses otherwise I would email you the link. I don't want to post my server address here. Anyway, Let me cath up with what you have been doing, which is a lot!
0
 
Geert BormansCommented:
1) The best way to be selective in XSLT is to use predicates
use
                                                <xsl:apply-templates select="//CATEGORIES/CATEGORY[@NAME = $cat]/BLOGS/BLOG[not(string-length(BLOGIMAGE/BLOGIMAGEPATH) = 0)]" />
instead of
                                                <xsl:apply-templates select="//CATEGORIES/CATEGORY[@NAME = $cat]/BLOGS/BLOG]" />
in the image xslt

0
 
Geert BormansCommented:
3) I don't get that
works fine with IE on my server
did you finally use the last XSLT I posted?
0
 
Lady_MAuthor Commented:
Ah okay predicates looks good.  I will try that now thanks Gertone.

Hi Hielo.  Glad to see you back.  I thought you might have left in disgust last night at my terrible XML 'skills'.  But poor Gertone is trapped!
I can't use window.onload because of IE.  It doesn't like it.  Event.observe usually works, but for some reason it isn't this time.





========================================================
Okay my complicated question and probably one of my last:  

The DropDown xslt output is actually a dropdown suckerfish menu that sits inside a banner.  
The top level is the square CATEGORYIMAGE, which when you roll over it the blog list would show in a dropdown box.  

By default all the lists were floated right in the banner.  And depending on what the body class was, the relevant list was floated to the left so it appeared first in navigation.  
I will paste some html and css below so you will be able to see how that happened a bit better.

(Don't worry  I'm not asking you to do that for me.  I had this all working in the old hard-coded version with css).

Though now I don't have a body class, but I guess I can do some matching on CATEGORY @NAME and $cat instead.  And float $cat left.
But I'm really not clear how to incorporate css with xslt.  Can I just put css classes in where I like?  Do I have to create a special XSLT class which says if CATEGORY @NAME = $cat then float left?
If you point me in the right direction I'll figure it out.

Does that make sense?  

<head>
<style>

/****dropDownNav****/
#bannerNav {position:relative; height: 40px; width: 962px; font-size:0.9em; z-index:99; }
/**dropDownNav Navigation:  **/

/*1st Level:  square images*/
#bannerNav ul#dropDownNav {position:absolute; top:4px; left:0; list-style:none; display:inline;margin:0; padding:0;  width:960px; height:30px; }

#bannerNav ul#dropDownNav li {position:relative; float:right; padding:0; list-style: none;width:30px; height:30px; margin: 0 5px; }/* default float right, float relevant Category left */

#bannerNav ul#dropDownNav li a {background-image:CATEGORYIMAGE; display:block; width:30px; height:30px; margin: 0; }
#bannerNav ul#dropDownNav li ul li a{ background-image:none;}

/*2nd Level: dropdown boxes*/
#bannerNav ul#dropDownNav li ul {position:absolute; left:-999em; top:30px; margin:0; padding:0; width:125px; border-top:6px solid #999999;  background:#F5F5F0; opacity:.95;z-index:60; text-align:left; clear: left; }
#bannerNav ul#dropDownNav li:hover ul{ left:0; display:block;}
#bannerNav ul#dropDownNav li li {height:auto; margin:0; padding:0; width:100%; }
#bannerNav ul#dropDownNav li li a{display:block; width:100%; height:auto; margin:0; padding:2px 5px; }
#bannerNav ul#dropDownNav li a:hover {display:block;}

</style>
</head>

<body>
<ul id="dropDownNav">
      <li class="CATEGORY@NAME"><a href="#">CATEGORYIMAGE</a>
              <ul>
             <li><a href="{BLOGURL}"><xsl:value-of select="BLOGTITLE"/></a></li>
             <li><a href="{BLOGURL}"><xsl:value-of select="BLOGTITLE"/></a></li>
                   etc...
              </ul>
      </li>
      <li class="CATEGORY@NAME"><a href="#">CATEGORYIMAGE</a>
              <ul>
             <li><a href="{BLOGURL}"><xsl:value-of select="BLOGTITLE"/></a></li>
             <li><a href="{BLOGURL}"><xsl:value-of select="BLOGTITLE"/></a></li>
                   ...
              </ul>
      </li>
      <li class="CATEGORY@NAME"><a href="#">CATEGORYIMAGE</a>
              <ul>
             <li><a href="{BLOGURL}"><xsl:value-of select="BLOGTITLE"/></a></li>
             <li><a href="{BLOGURL}"><xsl:value-of select="BLOGTITLE"/></a></li>
                   ...
             </ul>
      </li>
      <li class="CATEGORY@NAME"><a href="#">CATEGORYIMAGE</a>
              <ul>
             <li><a href="{BLOGURL}"><xsl:value-of select="BLOGTITLE"/></a></li>
             <li><a href="{BLOGURL}"><xsl:value-of select="BLOGTITLE"/></a></li>
                   ...
              </ul>
      </li>
      <li class="CATEGORY@NAME"><a href="#">CATEGORYIMAGE</a>
              <ul>
             <li><a href="{BLOGURL}"><xsl:value-of select="BLOGTITLE"/></a></li>
             <li><a href="{BLOGURL}"><xsl:value-of select="BLOGTITLE"/></a></li>
                   ...
              </ul>
      </li>
        <br class="clearFloat" />
</ul>
</body>
0
 
Lady_MAuthor Commented:
Have you cleared the cache Gertone?  Absolutely nothing is showing in Firefox or IE here.
Yes I am using your amended XSLT files.
0
 
Geert BormansCommented:
cache is cleared,
I always test the combination XML and XSLT in an XML IDE,
so I am certain that the XSLT is valid and works on teh XML

do you have that particular XSLT on the server?
I will then compare it with mine
0
 
Geert BormansCommented:
html elements in an XSLT are literal,
if you want to put classes in there, you can simply do that

<li class="thisclass"><xsl:value-of select="..."/> works perfectly

if you want a calculated value, you need {} , this indicates attribute value templates
eg.
<li class="{BLOG/BLOGTITLE}"><xsl:value-of select="..."/> would work

if you need a conditional on the class value, you can use xsl:attribute to create attributes
eg.
<li>
<xsl:attribute name="style">
<xsl:choose>
<xsl:when test="CATEGORY = $cat">
float:left;
</xsl:when>
</xsl:choose>
</xsl:attribute>
<xsl:value-of...



0
 
Lady_MAuthor Commented:
0
 
Lady_MAuthor Commented:
There seems to be a problem with this line in MailID:
<xsl:text>CATEGORY</xsl:text>
Invalid character.
0
 
Lady_MAuthor Commented:
sorry ignore last comment
0
 
Lady_MAuthor Commented:
Figured out the Event.observe probem.  I'd forgotten to copy my prototype.js file into the test area.  So that's fixed at least.
Seem to have a new problem with the predicate I added to imageLinkSet now.  I'm looking at that now.
0
 
hieloCommented:
1. If you open the mailID.xsl file directly through FF You will see that there is an "weird" caracter. Most likely there is an unprintable charcter that is why you do not see it. Try re-typing everygthing. In otherwords, replace it with:
<xsl:text>CATEGORY</xsl:text>

2. I am still getting the Event Error in FF and IE.
window.onload=init;

without parenthesis, has always worked for me and it works across browsers on my copy from last night. Basically it is assigning a reference to a function
window.onload=init(); would not work because at that point the onload event handler is being assigned the return value of init, not a reference to init.
0
 
hieloCommented:
OK. I see some progress has been made. I was in the middle of my previous composition when I had to step away. I see you fixed the event problem.
0
 
Lady_MAuthor Commented:
HI hielo
Ah okay, I've never tried it without the brackets, maybe that was the issue.

Well the problems at the moment seem to be that the imageLinkSet is not loading in either IE or Firefox.
And that the predicate is causing an error in the same file.

And I am working on adding some conditional css styling as described a few posts above.
0
 
Lady_MAuthor Commented:
Also there seems to be a MailID error in IE6 (not sure about IE7).  It doesn't show at least,and there is the error:"The stylesheet does not contain a document element."
0
 
hieloCommented:
There is no error in imageLinkSet.xsl, just no data match! Basically,
//CATEGORIES/CATEGORY[@NAME = $cat]/BLOGS/BLOG[not(string-length(BLOGIMAGE/BLOGIMAGEPATH) = 0)]
is unable to find the following path:
<CATEGORIES>
      <CATEGORY NAME="life">
            <BLOGS>
                  <BLOG>
                        not(string-length() = 0)]
                        <BLOGIMAGE>
                              <BLOGIMAGEPATH></BLOGIMAGEPATH>
                        </BLOGIMAGE>
                  </BLOG>
            </BLOGS>
      </CATEGORY>
</CATEGORIES>

The predicate will return a nodeset on all the "sub trees" similar to the path above, but whose <BLOGIMAGEPATH></BLOGIMAGEPATH> is NOT empty. In your data file, all the <BLOGIMAGEPATH></BLOGIMAGEPATH> are empty. Put something in between for testing.

0
 
Lady_MAuthor Commented:
Ah okay, yes of course.  Okay well in that case I suppose if there is no data match I don't want to output the error message or even the div.
So presumably I just change:
                        <xsl:otherwise>
                              <div>No Category was specified</div>
                        </xsl:otherwise>

to
                        <xsl:otherwise>
                                  nothing in here.
                        </xsl:otherwise>


Can I just leave that blank?  Or will it need something?

Can you see the issue with MailID by the way?
0
 
Geert BormansCommented:
the &#160; I put in is interpreted somewhere and put in the rong encoding
the xsl is no longer well formed
remove the space like character after CATEGORY in the xsl:text
and you will be fine
0
 
Lady_MAuthor Commented:
Ha weird.  I thought I tried that and it didn't work so I put it back in.  No matter.  It works now!  
Thank God!  Nearly there.
Just got to figure out this left float business on the dropDown.

I owe you both a bottle of something.  
0
 
Geert BormansCommented:
> I owe you both a bottle of something

That sounds encouraging
0
 
hieloCommented:
Here is a modified version of global.js. Backup your current copy and then use this one.
Sarissa throws exceptions. This version traps them and keep trying to execute the next statements and will tell you which file is the problem.
Incorporate:
<div id="bugReport"></div>
somewhere on your html page for now. You can get rid of later if you wish.
Also, there should not be any HTML Comment tags  on a Javascript file.

// JavaScript Document
var oXmlDoc;
var oXslDropDownDoc;
var oXslNavL1Doc;
var oXslImageLinkSetDoc;
var oXslMailIDDoc;
var oCategory;
var bugTracker="";
var LadyM_DEBUG=true;
function init()
{
            
      // create the xml document object
      try{
            oXmlDoc = Sarissa.getDomDocument();
            oXmlDoc.async = false;
            oXmlDoc.load("data/bloglist.xml");
      }
      catch(e)
      {
            updateBugTracker(e,"data/bloglist.xml");
      }

      // create the xsl document objects
      try{
            oXslDropDownDoc = Sarissa.getDomDocument();
              oXslDropDownDoc.async = false;
              oXslDropDownDoc.load("xsl/dropDown.xsl");
            showDropDown();
      }
      catch(e)
      {
            updateBugTracker(e,"xsl/dropDown.xsl");
      }

        try{
            oXslNavL1Doc = Sarissa.getDomDocument();
              oXslNavL1Doc.async = false;
              oXslNavL1Doc.load("xsl/navL1.xsl");
              showNavL1();
        }
      catch(e)
      {
            updateBugTracker(e,"xsl/navL1.xsl");
      }
       
        try{
            oXslImageLinkSetDoc = Sarissa.getDomDocument();
              oXslImageLinkSetDoc.async = false;
              oXslImageLinkSetDoc.load("xsl/imageLinkSet.xsl");
              showImageLinkSet();
        }
      catch(e)
      {
            updateBugTracker(e,"xsl/imageLinkSet.xsl");
      }
       
        try{
            oXslMailIDDoc = Sarissa.getDomDocument();
              oXslMailIDDoc.async = false;
              oXslMailIDDoc.load("xsl/mailID.xsl");
              showMailID();
        }
      catch(e)
      {
            updateBugTracker(e,"xsl/mailID.xsl");
      }

      if(bugTracker !="")
      {
            if(document.getElementById("bugReport"))
            {
                  document.getElementById("bugReport").innerHTML=bugTracker;
            }
            else
            {
                  alert(bugTracker);
            }
      }
}

function updateBugTracker(errObj,src)
{
      if(true!==LadyM_DEBUG)
            return;

      if(src)
            bugTracker+="<hr />Source: "+src;

      if(errObj)
            for(var prop in errObj)
            {
                  bugTracker+=prop + ": " + errObj[prop];
            }
}

//load function.
//Event.observe(window, 'load', function(){init();} );
window.onload=init;
            
      function showDropDown()
      {
        var xsltProc  = new XSLTProcessor();
        xsltProc.importStylesheet(oXslDropDownDoc);
        var resFrag = xsltProc.transformToDocument(oXmlDoc);
        document.getElementById("dropDown").innerHTML = new XMLSerializer().serializeToString(resFrag);
      }
      function showNavL1()
      {
        var xsltProc  = new XSLTProcessor();
        xsltProc.importStylesheet(oXslNavL1Doc);
        xsltProc.setParameter("", 'cat' , oCategory);
        var resFrag = xsltProc.transformToDocument(oXmlDoc);
        document.getElementById("navL1").innerHTML = new XMLSerializer().serializeToString(resFrag);
      }
      function showImageLinkSet()
      {
        var xsltProc  = new XSLTProcessor();
        xsltProc.importStylesheet(oXslImageLinkSetDoc);
        xsltProc.setParameter("", 'cat' , oCategory);
        var resFrag = xsltProc.transformToDocument(oXmlDoc);
        document.getElementById("imageLinkSet").innerHTML = new XMLSerializer().serializeToString(resFrag);
      }
        
        
      function showMailID()
      {
        var xsltProc  = new XSLTProcessor();
        xsltProc.importStylesheet(oXslMailIDDoc);
        var resFrag = xsltProc.transformToDocument(oXmlDoc);
        document.getElementById("mailID").innerHTML = new XMLSerializer().serializeToString(resFrag);
      }
0
 
hieloCommented:
You can remove the "otherwise" clause and it will still be fine. It is not required. In which case, instead of:
<xsl:choose>
 <xsl:when test="your predicate here">
  Your statement here
 </xsl:when>
</xsl:choose>

you can use:

<xsl:if test="your predicate here">
 your statement here
</xsl:if
0
 
hieloCommented:
I am not seeing any mailID problems. Thus, my guess is you already figured it out, as opposed to one of us seeing a cached page.
0
 
Lady_MAuthor Commented:
Hiya
I've actually removed mailID from the test page because I'm trying to implement it on the 'real' page.
http://www.webtasticdesigns.co.uk/testarea/xml/final/signup_v_xml.htm
0
 
Lady_MAuthor Commented:
But it's not displaying.  I'm still getting the error re. "The stylesheet does not contain a document element" in IE.  Nothing displaying in Firefox.
0
 
Lady_MAuthor Commented:
I've taken the test page down for now by the way.  I think the other three outputs are okay.  Just the mailID that's causing the issue.
0
 
Lady_MAuthor Commented:
I was being dumb.  It was the path to the xsl file that was wrong in the js file.
It's working now...
0
 
hieloCommented:
1.  You have the wrong Javascript path to sarissa_ieemu_xpath.js file. You have
arissa/sarissa_ieemu_xpath.js instead of sarissa/sarissa_ieemu_xpath.js

2. You keep putting HTML tags in Javascript files (http://www.webtasticdesigns.co.uk/testarea/xml/scripts/mail_signup.js). When the Javascript engine runs into "<!-- " on a line by itselt, what is it supposed to do?
"<!-- " is an HTML "beginning of comment" tag, not javascript.
0
 
Lady_MAuthor Commented:
1) Yeah I spotted that.  Corrected.

2) Those html comments are put in automatically by Dreamweaver.  I assumed it was to hide it from browsers that had javascript turned off or something.

I think everything is finally working!  I should be jumping up and down, but I've run out of power.

All that is left for me to do is sort out the float styling for the dropDown and I can't face that tonight.

I  have to be a bit muted cos it's public here, but to both you and Gertone, I cannot thank you enough!!!  You've been really amazing.  You are both great guys (girls?).  I wish I could give you millions of points.  

What's your email hielo?
0
 
Geert BormansCommented:
I am a guy and you are welcome
0
 
hieloCommented:
I am one hell of a guy and you are very welcome!
Ha, ha!

By the way, I believe none of us like to put our email addresses in the public domain due to spamming. How about you put yours in html code of your page and I get it from there. Once you receive my email you can remove it from your html comment.

Wasn't this fun?

Gertone, keep it up. Pretty soon you will have enough stripes to be a "General".
0
 
Lady_MAuthor Commented:
I wanted to send you something to say thanks.  I was looking for alcohol vouchers, but you don't live in the UK I think and it costs three times as much to post it abroad as it does to actually buy it and there seems to be no international company - a missed business opportunity I think.
I will post my email up tomorrow eve.  

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 57
  • 42
  • 26
Tackle projects and never again get stuck behind a technical roadblock.
Join Now