mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-04 04:58:00 +00:00
Removing old files which have been copies in CVS to content/xslt, see bug 304494
This commit is contained in:
parent
a42bc6dc4f
commit
4197ed9e82
@ -1 +0,0 @@
|
||||
Makefile
|
@ -1,49 +0,0 @@
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org Code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = public
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
@ -1 +0,0 @@
|
||||
Makefile
|
@ -1,59 +0,0 @@
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2002
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Peter Van der Beken <peterv@netscape.com> (original author)
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = content
|
||||
XPIDL_MODULE = content_xslt
|
||||
|
||||
EXPORTS = \
|
||||
nsIDocumentTransformer.h \
|
||||
$(NULL)
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsIXSLTException.idl \
|
||||
nsIXSLTProcessor.idl \
|
||||
nsIXSLTProcessorObsolete.idl \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
@ -1,83 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Jonas Sicking <sicking@bigfoot.com> (Original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsIDocumentTransformer_h__
|
||||
#define nsIDocumentTransformer_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIDOMDocument;
|
||||
class nsIDOMNode;
|
||||
class nsILoadGroup;
|
||||
class nsIURI;
|
||||
class nsIPrincipal;
|
||||
|
||||
#define NS_ITRANSFORMOBSERVER_IID \
|
||||
{0xcce88481, 0x6eb3, 0x11d6, \
|
||||
{ 0xa7, 0xf2, 0x8d, 0x82, 0xcd, 0x2a, 0xf3, 0x7c }}
|
||||
|
||||
class nsITransformObserver : public nsISupports
|
||||
{
|
||||
public:
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ITRANSFORMOBSERVER_IID)
|
||||
|
||||
NS_IMETHOD OnDocumentCreated(nsIDOMDocument *aResultDocument) = 0;
|
||||
|
||||
NS_IMETHOD OnTransformDone(nsresult aResult,
|
||||
nsIDOMDocument *aResultDocument) = 0;
|
||||
|
||||
};
|
||||
|
||||
#define NS_IDOCUMENTTRANSFORMER_IID \
|
||||
{0x43e5a6c6, 0xa53c, 0x4f97, \
|
||||
{ 0x91, 0x79, 0x47, 0xf2, 0x46, 0xec, 0xd9, 0xd6 }}
|
||||
|
||||
class nsIDocumentTransformer : public nsISupports
|
||||
{
|
||||
public:
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOCUMENTTRANSFORMER_IID)
|
||||
|
||||
NS_IMETHOD SetTransformObserver(nsITransformObserver* aObserver) = 0;
|
||||
NS_IMETHOD LoadStyleSheet(nsIURI* aUri, nsILoadGroup* aLoadGroup,
|
||||
nsIPrincipal* aCallerPrincipal) = 0;
|
||||
NS_IMETHOD SetSourceContentModel(nsIDOMNode* aSource) = 0;
|
||||
NS_IMETHOD CancelLoads() = 0;
|
||||
};
|
||||
|
||||
#endif //nsIDocumentTransformer_h__
|
@ -1,53 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT Processor.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Axel Hecht.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Axel Hecht, <axel@pike.org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIException.idl"
|
||||
#include "domstubs.idl"
|
||||
|
||||
[scriptable, uuid(e06dfaea-92d5-47f7-a800-c5f5404d8771)]
|
||||
interface nsIXSLTException : nsIException {
|
||||
/**
|
||||
* The node in the stylesheet that triggered the exception.
|
||||
*/
|
||||
readonly attribute nsIDOMNode styleNode;
|
||||
|
||||
/**
|
||||
* The context node, may be null
|
||||
*/
|
||||
readonly attribute nsIDOMNode sourceNode;
|
||||
};
|
@ -1,134 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT Processor.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Axel Hecht.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Axel Hecht, <axel@pike.org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "domstubs.idl"
|
||||
|
||||
interface nsIVariant;
|
||||
|
||||
[scriptable, uuid(4a91aeb3-4100-43ee-a21e-9866268757c5)]
|
||||
interface nsIXSLTProcessor : nsISupports
|
||||
{
|
||||
/**
|
||||
* Import the stylesheet into this XSLTProcessor for transformations.
|
||||
*
|
||||
* @param style The root-node of a XSLT stylesheet. This can be either
|
||||
* a document node or an element node. If a document node
|
||||
* then the document can contain either a XSLT stylesheet
|
||||
* or a LRE stylesheet.
|
||||
* If the argument is an element node it must be the
|
||||
* xsl:stylesheet (or xsl:transform) element of an XSLT
|
||||
* stylesheet.
|
||||
*
|
||||
* @exception nsIXSLTException
|
||||
*/
|
||||
void importStylesheet(in nsIDOMNode style);
|
||||
|
||||
/**
|
||||
* Transforms the node source applying the stylesheet given by
|
||||
* the importStylesheet() function. The owner document of the output node
|
||||
* owns the returned document fragment.
|
||||
*
|
||||
* @param source The node to be transformed
|
||||
* @param output This document is used to generate the output
|
||||
* @return DocumentFragment The result of the transformation
|
||||
*
|
||||
* @exception nsIXSLTException
|
||||
*/
|
||||
nsIDOMDocumentFragment transformToFragment(in nsIDOMNode source,
|
||||
in nsIDOMDocument output);
|
||||
|
||||
/**
|
||||
* Transforms the node source applying the stylesheet given by the
|
||||
* importStylesheet() function.
|
||||
*
|
||||
* @param source The node to be transformed
|
||||
* @return Document The result of the transformation
|
||||
*
|
||||
* @exception nsIXSLTException
|
||||
*/
|
||||
nsIDOMDocument transformToDocument(in nsIDOMNode source);
|
||||
|
||||
/**
|
||||
* Sets a parameter to be used in subsequent transformations with this
|
||||
* nsIXSLTProcessor. If the parameter doesn't exist in the stylesheet the
|
||||
* parameter will be ignored.
|
||||
*
|
||||
* @param namespaceURI The namespaceURI of the XSLT parameter
|
||||
* @param localName The local name of the XSLT parameter
|
||||
* @param value The new value of the XSLT parameter
|
||||
*
|
||||
* @exception NS_ERROR_ILLEGAL_VALUE The datatype of value is
|
||||
* not supported
|
||||
*/
|
||||
void setParameter(in DOMString namespaceURI,
|
||||
in DOMString localName,
|
||||
in nsIVariant value);
|
||||
|
||||
/**
|
||||
* Gets a parameter if previously set by setParameter. Returns null
|
||||
* otherwise.
|
||||
*
|
||||
* @param namespaceURI The namespaceURI of the XSLT parameter
|
||||
* @param localName The local name of the XSLT parameter
|
||||
* @return nsIVariant The value of the XSLT parameter
|
||||
*/
|
||||
nsIVariant getParameter(in DOMString namespaceURI,
|
||||
in DOMString localName);
|
||||
/**
|
||||
* Removes a parameter, if set. This will make the processor use the
|
||||
* default-value for the parameter as specified in the stylesheet.
|
||||
*
|
||||
* @param namespaceURI The namespaceURI of the XSLT parameter
|
||||
* @param localName The local name of the XSLT parameter
|
||||
*/
|
||||
void removeParameter(in DOMString namespaceURI,
|
||||
in DOMString localName);
|
||||
|
||||
/**
|
||||
* Removes all set parameters from this nsIXSLTProcessor. This will make
|
||||
* the processor use the default-value for all parameters as specified in
|
||||
* the stylesheet.
|
||||
*/
|
||||
void clearParameters();
|
||||
|
||||
/**
|
||||
* Remove all parameters and stylesheets from this nsIXSLTProcessor.
|
||||
*/
|
||||
void reset();
|
||||
};
|
@ -1,57 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Nisheeth Ranjan <nisheeth@netscape.com> (original author)
|
||||
* Peter Van der Beken <peterv@netscape.com>
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDOMNode;
|
||||
interface nsIDOMDocument;
|
||||
|
||||
/**
|
||||
* DEPRECATED! Don't use this interface! Use nsIXSLTProcessor instead!!
|
||||
*/
|
||||
|
||||
[scriptable, uuid(3fbff728-2d20-11d3-aef3-00108300ff91)]
|
||||
interface nsIXSLTProcessorObsolete : nsISupports
|
||||
{
|
||||
void transformDocument(in nsIDOMNode aSourceDOM,
|
||||
in nsIDOMNode aStyleDOM,
|
||||
in nsIDOMDocument aOutputDOC,
|
||||
in nsISupports aObserver);
|
||||
};
|
@ -1,2 +0,0 @@
|
||||
title {font-weight: bold;}
|
||||
author {font-style: italic;}
|
@ -1,5 +0,0 @@
|
||||
<?xml version='1.0'?>
|
||||
<?xml-stylesheet href="book.xsl" type="text/xsl"?>
|
||||
<doc>
|
||||
<title>Nisheeth's Document</title>
|
||||
</doc>
|
@ -1,18 +0,0 @@
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:template pattern="doc">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>A Document</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<xsl:process-children/>
|
||||
</BODY>
|
||||
</HTML>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template pattern="title">
|
||||
<H1>
|
||||
<xsl:process-children/>
|
||||
</H1>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
@ -1 +0,0 @@
|
||||
Makefile
|
@ -1,51 +0,0 @@
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is TransforMiiX XSLT processor code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Axel Hecht.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2001
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Axel Hecht <axel@pike.org>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = transformiix
|
||||
DIRS = source
|
||||
ifndef TX_EXE
|
||||
DIRS += build resources
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
@ -1 +0,0 @@
|
||||
Makefile
|
@ -1,94 +0,0 @@
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is TransforMiiX XSLT processor code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Axel Hecht.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2001
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Axel Hecht <axel@pike.org>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = transformiix
|
||||
LIBRARY_NAME = transformiix
|
||||
EXPORT_LIBRARY = 1
|
||||
IS_COMPONENT = 1
|
||||
MODULE_NAME = TransformiixModule
|
||||
ifneq ($(OS_ARCH),WINNT)
|
||||
SHORT_LIBNAME = t8iix
|
||||
endif
|
||||
MOZILLA_INTERNAL_API = 1
|
||||
|
||||
PACKAGE_FILE = transformiix.pkg
|
||||
|
||||
REQUIRES = xpcom \
|
||||
string \
|
||||
dom \
|
||||
content \
|
||||
layout \
|
||||
widget \
|
||||
necko \
|
||||
js \
|
||||
xpconnect \
|
||||
caps \
|
||||
htmlparser \
|
||||
$(NULL)
|
||||
|
||||
|
||||
CPPSRCS = XSLTProcessorModule.cpp
|
||||
|
||||
SHARED_LIBRARY_LIBS = \
|
||||
$(DIST)/lib/$(LIB_PREFIX)txbase_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)txxml_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)txxmlparser_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)txxpath_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)txxslt_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)txxsltfunctions_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)txxsltutil_s.$(LIB_SUFFIX) \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_DSO_LDOPTS += \
|
||||
$(MOZ_UNICHARUTIL_LIBS) \
|
||||
$(MOZ_COMPONENT_LIBS) \
|
||||
$(MOZ_JS_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
INCLUDES += -I$(srcdir)/../source/xslt -I$(srcdir)/../source/base \
|
||||
-I$(srcdir)/../source/xml -I$(srcdir)/../source/xml/parser \
|
||||
-I$(srcdir)/../source/xpath -I$(srcdir)/../source/xslt/util \
|
||||
-I$(srcdir)/../source/xslt/functions
|
@ -1,324 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Peter Van der Beken.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1999
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Peter Van der Beken <peterv@propagandism.org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsICategoryManager.h"
|
||||
#include "nsIDOMClassInfo.h"
|
||||
#include "nsIDOMNSXPathExpression.h"
|
||||
#include "nsIDOMXPathExpression.h"
|
||||
#include "nsIDOMXPathNSResolver.h"
|
||||
#include "nsIDOMXPathResult.h"
|
||||
#include "nsIErrorService.h"
|
||||
#include "nsIExceptionService.h"
|
||||
#include "nsIGenericFactory.h"
|
||||
#include "nsIParserService.h"
|
||||
#include "nsIScriptNameSpaceManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsXPathEvaluator.h"
|
||||
#include "nsXPathException.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "txAtoms.h"
|
||||
#include "txMozillaXSLTProcessor.h"
|
||||
#include "TxLog.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "txURIUtils.h"
|
||||
#include "txXSLTProcessor.h"
|
||||
#include "nsXPath1Scheme.h"
|
||||
|
||||
#ifndef DISABLE_XFORMS_HOOKS
|
||||
#include "nsXFormsXPathEvaluator.h"
|
||||
#endif
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsXPath1SchemeProcessor)
|
||||
|
||||
/* 1c1a3c01-14f6-11d6-a7f2-ea502af815dc */
|
||||
#define TRANSFORMIIX_DOMCI_EXTENSION_CID \
|
||||
{ 0x1c1a3c01, 0x14f6, 0x11d6, {0xa7, 0xf2, 0xea, 0x50, 0x2a, 0xf8, 0x15, 0xdc} }
|
||||
|
||||
/* {0C351177-0159-4500-86B0-A219DFDE4258} */
|
||||
#define TRANSFORMIIX_XPATH1_SCHEME_CID \
|
||||
{ 0xc351177, 0x159, 0x4500, { 0x86, 0xb0, 0xa2, 0x19, 0xdf, 0xde, 0x42, 0x58 } }
|
||||
|
||||
#define TRANSFORMIIX_DOMCI_EXTENSION_CONTRACTID \
|
||||
"@mozilla.org/transformiix-domci-extender;1"
|
||||
|
||||
NS_DOMCI_EXTENSION(Transformiix)
|
||||
static NS_DEFINE_CID(kXSLTProcessorCID, TRANSFORMIIX_XSLT_PROCESSOR_CID);
|
||||
NS_DOMCI_EXTENSION_ENTRY_BEGIN(XSLTProcessor)
|
||||
NS_DOMCI_EXTENSION_ENTRY_INTERFACE(nsIXSLTProcessor)
|
||||
NS_DOMCI_EXTENSION_ENTRY_INTERFACE(nsIXSLTProcessorObsolete) // XXX DEPRECATED
|
||||
NS_DOMCI_EXTENSION_ENTRY_END(XSLTProcessor, nsIXSLTProcessor, PR_TRUE,
|
||||
&kXSLTProcessorCID)
|
||||
|
||||
static NS_DEFINE_CID(kXPathEvaluatorCID, TRANSFORMIIX_XPATH_EVALUATOR_CID);
|
||||
NS_DOMCI_EXTENSION_ENTRY_BEGIN(XPathEvaluator)
|
||||
NS_DOMCI_EXTENSION_ENTRY_INTERFACE(nsIDOMXPathEvaluator)
|
||||
NS_DOMCI_EXTENSION_ENTRY_END(XPathEvaluator, nsIDOMXPathEvaluator, PR_TRUE,
|
||||
&kXPathEvaluatorCID)
|
||||
|
||||
NS_DOMCI_EXTENSION_ENTRY_BEGIN(XPathException)
|
||||
NS_DOMCI_EXTENSION_ENTRY_INTERFACE(nsIDOMXPathException)
|
||||
NS_DOMCI_EXTENSION_ENTRY_INTERFACE(nsIException)
|
||||
NS_DOMCI_EXTENSION_ENTRY_END(XPathException, nsIDOMXPathException, PR_TRUE,
|
||||
nsnull)
|
||||
|
||||
NS_DOMCI_EXTENSION_ENTRY_BEGIN(XPathExpression)
|
||||
NS_DOMCI_EXTENSION_ENTRY_INTERFACE(nsIDOMXPathExpression)
|
||||
NS_DOMCI_EXTENSION_ENTRY_INTERFACE(nsIDOMNSXPathExpression)
|
||||
NS_DOMCI_EXTENSION_ENTRY_END(XPathExpression, nsIDOMXPathExpression,
|
||||
PR_TRUE, nsnull)
|
||||
|
||||
NS_DOMCI_EXTENSION_ENTRY_BEGIN(XPathNSResolver)
|
||||
NS_DOMCI_EXTENSION_ENTRY_INTERFACE(nsIDOMXPathNSResolver)
|
||||
NS_DOMCI_EXTENSION_ENTRY_END(XPathNSResolver, nsIDOMXPathNSResolver,
|
||||
PR_TRUE, nsnull)
|
||||
|
||||
NS_DOMCI_EXTENSION_ENTRY_BEGIN(XPathResult)
|
||||
NS_DOMCI_EXTENSION_ENTRY_INTERFACE(nsIDOMXPathResult)
|
||||
NS_DOMCI_EXTENSION_ENTRY_END(XPathResult, nsIDOMXPathResult, PR_TRUE,
|
||||
nsnull)
|
||||
NS_DOMCI_EXTENSION_END
|
||||
|
||||
// Factory Constructor
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(txMozillaXSLTProcessor)
|
||||
NS_GENERIC_AGGREGATED_CONSTRUCTOR_INIT(nsXPathEvaluator, Init)
|
||||
#ifndef DISABLE_XFORMS_HOOKS
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsXFormsXPathEvaluator)
|
||||
#endif
|
||||
|
||||
NS_DECL_DOM_CLASSINFO(XSLTProcessor)
|
||||
NS_DECL_DOM_CLASSINFO(XPathEvaluator)
|
||||
NS_DECL_DOM_CLASSINFO(XPathException)
|
||||
NS_DECL_DOM_CLASSINFO(XPathExpression)
|
||||
NS_DECL_DOM_CLASSINFO(XPathNSResolver)
|
||||
NS_DECL_DOM_CLASSINFO(XPathResult)
|
||||
|
||||
static NS_METHOD
|
||||
RegisterTransformiix(nsIComponentManager *aCompMgr,
|
||||
nsIFile *aPath,
|
||||
const char *registryLocation,
|
||||
const char *componentType,
|
||||
const nsModuleComponentInfo *info)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsCOMPtr<nsICategoryManager> catman =
|
||||
do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsXPIDLCString previous;
|
||||
rv = catman->AddCategoryEntry(JAVASCRIPT_DOM_CLASS,
|
||||
"XSLTProcessor",
|
||||
TRANSFORMIIX_DOMCI_EXTENSION_CONTRACTID,
|
||||
PR_TRUE, PR_TRUE, getter_Copies(previous));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = catman->AddCategoryEntry(JAVASCRIPT_DOM_CLASS,
|
||||
"XPathEvaluator",
|
||||
TRANSFORMIIX_DOMCI_EXTENSION_CONTRACTID,
|
||||
PR_TRUE, PR_TRUE, getter_Copies(previous));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = catman->AddCategoryEntry(JAVASCRIPT_DOM_CLASS,
|
||||
"XPathException",
|
||||
TRANSFORMIIX_DOMCI_EXTENSION_CONTRACTID,
|
||||
PR_TRUE, PR_TRUE, getter_Copies(previous));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = catman->AddCategoryEntry(JAVASCRIPT_DOM_CLASS,
|
||||
"XPathExpression",
|
||||
TRANSFORMIIX_DOMCI_EXTENSION_CONTRACTID,
|
||||
PR_TRUE, PR_TRUE, getter_Copies(previous));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = catman->AddCategoryEntry(JAVASCRIPT_DOM_CLASS,
|
||||
"XPathNSResolver",
|
||||
TRANSFORMIIX_DOMCI_EXTENSION_CONTRACTID,
|
||||
PR_TRUE, PR_TRUE, getter_Copies(previous));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = catman->AddCategoryEntry(JAVASCRIPT_DOM_CLASS,
|
||||
"XPathResult",
|
||||
TRANSFORMIIX_DOMCI_EXTENSION_CONTRACTID,
|
||||
PR_TRUE, PR_TRUE, getter_Copies(previous));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
char* iidString = NS_GET_IID(nsIXSLTProcessorObsolete).ToString();
|
||||
if (!iidString)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
rv = catman->AddCategoryEntry(JAVASCRIPT_DOM_INTERFACE,
|
||||
"nsIXSLTProcessorObsolete",
|
||||
iidString,
|
||||
PR_TRUE, PR_TRUE, getter_Copies(previous));
|
||||
nsCRT::free(iidString);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
iidString = NS_GET_IID(nsIXSLTProcessor).ToString();
|
||||
if (!iidString)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
rv = catman->AddCategoryEntry(JAVASCRIPT_DOM_INTERFACE,
|
||||
"nsIXSLTProcessor",
|
||||
iidString,
|
||||
PR_TRUE, PR_TRUE, getter_Copies(previous));
|
||||
nsCRT::free(iidString);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
static PRBool gInitialized = PR_FALSE;
|
||||
static nsIExceptionProvider *gXPathExceptionProvider = 0;
|
||||
nsINameSpaceManager *gTxNameSpaceManager = 0;
|
||||
nsIParserService *gTxParserService = 0;
|
||||
|
||||
// Perform our one-time intialization for this module
|
||||
PR_STATIC_CALLBACK(nsresult)
|
||||
Initialize(nsIModule* aSelf)
|
||||
{
|
||||
NS_PRECONDITION(!gInitialized, "module already initialized");
|
||||
if (gInitialized)
|
||||
return NS_OK;
|
||||
|
||||
gInitialized = PR_TRUE;
|
||||
|
||||
gXPathExceptionProvider = new nsXPathExceptionProvider();
|
||||
if (!gXPathExceptionProvider)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(gXPathExceptionProvider);
|
||||
nsCOMPtr<nsIExceptionService> xs =
|
||||
do_GetService(NS_EXCEPTIONSERVICE_CONTRACTID);
|
||||
if (xs)
|
||||
xs->RegisterExceptionProvider(gXPathExceptionProvider,
|
||||
NS_ERROR_MODULE_DOM_XPATH);
|
||||
|
||||
if (!txXSLTProcessor::init()) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
nsresult rv = CallGetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID,
|
||||
&gTxSecurityManager);
|
||||
if (NS_FAILED(rv)) {
|
||||
gTxSecurityManager = nsnull;
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = CallGetService(NS_NAMESPACEMANAGER_CONTRACTID, &gTxNameSpaceManager);
|
||||
if (NS_FAILED(rv)) {
|
||||
gTxNameSpaceManager = nsnull;
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = CallGetService("@mozilla.org/parser/parser-service;1",
|
||||
&gTxParserService);
|
||||
if (NS_FAILED(rv)) {
|
||||
gTxParserService = nsnull;
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIErrorService> errorService =
|
||||
do_GetService(NS_ERRORSERVICE_CONTRACTID);
|
||||
if (errorService) {
|
||||
errorService->RegisterErrorStringBundle(NS_ERROR_MODULE_XSLT,
|
||||
XSLT_MSGS_URL);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Shutdown this module, releasing all of the module resources
|
||||
PR_STATIC_CALLBACK(void)
|
||||
Shutdown(nsIModule* aSelf)
|
||||
{
|
||||
NS_PRECONDITION(gInitialized, "module not initialized");
|
||||
if (!gInitialized)
|
||||
return;
|
||||
|
||||
gInitialized = PR_FALSE;
|
||||
if (gXPathExceptionProvider) {
|
||||
nsCOMPtr<nsIExceptionService> xs =
|
||||
do_GetService(NS_EXCEPTIONSERVICE_CONTRACTID);
|
||||
if (xs)
|
||||
xs->UnregisterExceptionProvider(gXPathExceptionProvider,
|
||||
NS_ERROR_MODULE_DOM_XPATH);
|
||||
NS_RELEASE(gXPathExceptionProvider);
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(NS_CLASSINFO_NAME(XSLTProcessor));
|
||||
NS_IF_RELEASE(NS_CLASSINFO_NAME(XPathEvaluator));
|
||||
NS_IF_RELEASE(NS_CLASSINFO_NAME(XPathException));
|
||||
NS_IF_RELEASE(NS_CLASSINFO_NAME(XPathExpression));
|
||||
NS_IF_RELEASE(NS_CLASSINFO_NAME(XPathNSResolver));
|
||||
NS_IF_RELEASE(NS_CLASSINFO_NAME(XPathResult));
|
||||
|
||||
txXSLTProcessor::shutdown();
|
||||
|
||||
NS_IF_RELEASE(gTxSecurityManager);
|
||||
NS_IF_RELEASE(gTxNameSpaceManager);
|
||||
NS_IF_RELEASE(gTxParserService);
|
||||
}
|
||||
|
||||
// Component Table
|
||||
static const nsModuleComponentInfo gComponents[] = {
|
||||
{ "XSLTProcessor",
|
||||
TRANSFORMIIX_XSLT_PROCESSOR_CID,
|
||||
TRANSFORMIIX_XSLT_PROCESSOR_CONTRACTID,
|
||||
txMozillaXSLTProcessorConstructor,
|
||||
RegisterTransformiix },
|
||||
{ "XPathEvaluator",
|
||||
TRANSFORMIIX_XPATH_EVALUATOR_CID,
|
||||
NS_XPATH_EVALUATOR_CONTRACTID,
|
||||
nsXPathEvaluatorConstructor },
|
||||
#ifndef DISABLE_XFORMS_HOOKS
|
||||
{ "XFormsXPathEvaluator",
|
||||
TRANSFORMIIX_XFORMS_XPATH_EVALUATOR_CID,
|
||||
NS_XFORMS_XPATH_EVALUATOR_CONTRACTID,
|
||||
nsXFormsXPathEvaluatorConstructor },
|
||||
#endif
|
||||
{ "Transformiix DOMCI Extender",
|
||||
TRANSFORMIIX_DOMCI_EXTENSION_CID,
|
||||
TRANSFORMIIX_DOMCI_EXTENSION_CONTRACTID,
|
||||
NS_DOMCI_EXTENSION_CONSTRUCTOR(Transformiix) },
|
||||
{ "XPath1 XPointer Scheme Processor",
|
||||
TRANSFORMIIX_XPATH1_SCHEME_CID,
|
||||
NS_XPOINTER_SCHEME_PROCESSOR_BASE "xpath1",
|
||||
nsXPath1SchemeProcessorConstructor }
|
||||
};
|
||||
|
||||
NS_IMPL_NSGETMODULE_WITH_CTOR_DTOR(TransformiixModule, gComponents,
|
||||
Initialize, Shutdown)
|
@ -1,30 +0,0 @@
|
||||
var err = initInstall("Transformiix", "Transformiix", $Version$);
|
||||
logComment("initInstall: " + err);
|
||||
|
||||
var fProgram = getFolder("Program");
|
||||
logComment("fProgram: " + fProgram);
|
||||
|
||||
if (verifyDiskSpace(fProgram, $SpaceRequired$))
|
||||
{
|
||||
err = addDirectory("Transformiix",
|
||||
$Version$,
|
||||
"bin",
|
||||
fProgram,
|
||||
"",
|
||||
true );
|
||||
|
||||
logComment("addDirectory() returned: " + err);
|
||||
|
||||
if (err==SUCCESS)
|
||||
{
|
||||
err = performInstall();
|
||||
logComment("performInstall() returned: " + err);
|
||||
}
|
||||
else
|
||||
{
|
||||
cancelInstall(err);
|
||||
logComment("cancelInstall() due to error: " + err);
|
||||
}
|
||||
}
|
||||
else
|
||||
cancelInstall(INSUFFICIENT_DISK_SPACE);
|
@ -1,12 +0,0 @@
|
||||
# right now this only packages the mozilla component
|
||||
# we can think about standalone too
|
||||
|
||||
# xxxbsmedberg: should this move to the GRE?
|
||||
# currently transformiix is not part of the default firebird
|
||||
# build, but that can be controlled by --enable-extensions
|
||||
[xpfe-browser browser]
|
||||
#if SHARED_LIBRARY
|
||||
dist/bin/components/@SHARED_LIBRARY@
|
||||
#else
|
||||
!staticcomp @LIBRARY@ @MODULE_NAME@
|
||||
#endif
|
@ -1,260 +0,0 @@
|
||||
***** BEGIN LICENSE BLOCK *****
|
||||
Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is TransforMiiX.
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
The MITRE Corporation, Keith Visco, et al.
|
||||
Portions created by the Initial Developer are Copyright (C) 1999-2000
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
||||
Alternatively, the contents of this file may be used under the terms of
|
||||
either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
of those above. If you wish to allow use of your version of this file only
|
||||
under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
use your version of this file under the terms of the MPL, indicate your
|
||||
decision by deleting the provisions above and replace them with the notice
|
||||
and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
the provisions above, a recipient may use your version of this file under
|
||||
the terms of any one of the MPL, the GPL or the LGPL.
|
||||
|
||||
***** END LICENSE BLOCK *****
|
||||
|
||||
Note: The changes listed here mainly reflect the core XSLT processor and
|
||||
the standalone version.
|
||||
|
||||
Build 20000906
|
||||
|
||||
-- Fixed UTF8 bug
|
||||
- reported by Steve Tinney (stinney@sas.upenn.edu)
|
||||
|
||||
-- Updated Expat for standalone version
|
||||
|
||||
Build 20000725
|
||||
|
||||
-- Windows Makefiles are up to date to create Mozilla module
|
||||
- thanx to Arthur Barrett and Justin Smith
|
||||
|
||||
Build 20000722
|
||||
|
||||
-- Fixed leading + trailing whitspace when printing comments
|
||||
- reported by Jeff Bailey
|
||||
|
||||
-- Fixed bug in ExprLexer caused by a previous patch
|
||||
- The prevToken was being set to NULL, in cases when
|
||||
it shouldn't have been
|
||||
- discovered when looking for an error reported by
|
||||
Bernhard Zwischenbrugger
|
||||
|
||||
Build 20000618
|
||||
|
||||
-- Added changes from Olivier Gerardin for improved
|
||||
handling of template parameters
|
||||
|
||||
Build 20000523
|
||||
|
||||
-- Added fix from Marc Schefer regarding OR expressions
|
||||
- If the left hand expression was false...the right
|
||||
hand expression was not evaluated (which should
|
||||
only happen if the expression is an AND expr).
|
||||
|
||||
-- Added support for document() function
|
||||
- implemented by Olivier Gerardin
|
||||
- The second argument to the function is not yet supported
|
||||
|
||||
-- Added support for lang() function
|
||||
- implemented by Marina Mechtcherikova
|
||||
|
||||
-- Fixed bug with doing xsl:copy-of on a document node.
|
||||
- reported by Olivier Gerardin
|
||||
|
||||
|
||||
Build 20000420
|
||||
|
||||
-- Fixed document base issue with transfromiix.cpp (Nathan)
|
||||
- When an XSLT stylesheet is specified on the command line
|
||||
the document base was still defaulting to the XML document,
|
||||
instead of the stylesheet
|
||||
|
||||
-- Fixed bug in namespace-uri() function [NodeSetFunctionCall.cpp] - Marina
|
||||
- If an expression was passed as an argument to the function,
|
||||
which evaluated to an empty NodeSet, the context node was being
|
||||
used, which is incorrect. We now just return an empty string.
|
||||
|
||||
-- Fixed bug in PathExpr::matches (Marina)
|
||||
- expressions such as "foo//bar" would not always match
|
||||
properly if more than one node existed in the final
|
||||
set of "matching context nodes" (so basically if foo
|
||||
was not the root element).
|
||||
|
||||
|
||||
Build 20000419
|
||||
|
||||
-- Added the generate-id function
|
||||
-- Added XPath Extension Function support
|
||||
|
||||
Build 20000413
|
||||
|
||||
-- Added some bug fixes from Marina
|
||||
-- fixed parsing of multiple predicates
|
||||
-- added support to handle attribute-set recursion
|
||||
-- added appropriate calls to handle use-attribute-sets on xsl:copy
|
||||
|
||||
Build 20000412
|
||||
|
||||
-- Fixed the following Axes names in Names.cpp so that
|
||||
the are compatible with the XSLT 1.0 recommendation (Marina)
|
||||
-- FOLLOWING_SIBLING_AXIS - removed the trailing s
|
||||
-- PRECEDING_SIBLING_AXIS - removed the trailing s
|
||||
|
||||
-- Added support for xsl:sort (kvisco)
|
||||
-- simple sorting is working...documentation to follow
|
||||
-- Added StringComparator and DefaultStringComparator
|
||||
-- we need some more comparators for I18N support
|
||||
-- Did some directory structure changes
|
||||
- source/xsl is now source/xslt
|
||||
- source/xsl/expr is now source/xpath
|
||||
-- Changed xslt/XSLProcessor.* to XSLTProcessor.*
|
||||
|
||||
-- Incorporated some changes from Olivier Gerardin for the Expat parser
|
||||
|
||||
Build 20000331
|
||||
|
||||
-- Fixed a memory leak with translate() function (kvisco)
|
||||
-- StringFunctionCall.cpp
|
||||
-- Updated the necessary source files to support the changes to
|
||||
the String class (kvisco)
|
||||
-- Overloaded String::toCharArray to automatically create the
|
||||
character array (tomk)
|
||||
-- Changed String::toChar to String::toCharArray (tomk)
|
||||
|
||||
|
||||
Build 20000327
|
||||
-- Fixed "dot" bug in CNAME parsing (ExprLexer.cpp) reported by Nathan Pride
|
||||
|
||||
Build 20000326
|
||||
-- Added Peter Van der Beken's changes to net/URIUtils for integration
|
||||
within Mozilla
|
||||
|
||||
-- Added Marina Mechtcheriakova's changes to xml/parser/XMLParser.cpp to fix
|
||||
a Unicode bug in ::startElement. Instead of improperly casting char*
|
||||
as DOM_CHAR*, the proper String constructor, String(char*) is used
|
||||
|
||||
Build 20000322
|
||||
-- Added Unicode bug fix from Lidong
|
||||
|
||||
Build 20000318
|
||||
-- Added Olivier's implementation of the XPath Number functions
|
||||
-- Added missing prototype to TxString.h (Peter Van der Beken)
|
||||
|
||||
Build 20000222
|
||||
-- Added Attribute parent mapping since DOM 1.0 doesn't support it
|
||||
-- Added default sorting of NodeSet by DocumentOrder
|
||||
-- yes this is a hint that xsl:sort is will be available soon
|
||||
|
||||
Build 20000218
|
||||
-- Fixed bug reported by Thiery Le Bouil, xsl:param was getting
|
||||
processed, and then treated as a literal element
|
||||
|
||||
Build 20000217
|
||||
|
||||
-- Changed StringList#iterator to return a pointer instead of a reference
|
||||
-- Added patches from Eric Du for FreeBSD, sorry for the delay in committing these
|
||||
|
||||
Build 20000216
|
||||
|
||||
-- Fixed bug with using wildcards directly after the parent operator, such as "/*"
|
||||
-- Fixed bug with PredicateList#isEmpty which was returning the opposite of the
|
||||
expected value.
|
||||
-- this also caused default priorities to be incorrectly calculated.
|
||||
|
||||
Build 19991110
|
||||
-- fixed bug with PathExpr and LocationStep with respect
|
||||
to the ::match method
|
||||
-- problem reported by Oblix
|
||||
-- Added support for xsl:include (only file URLs will work)
|
||||
-- fixed the built-in xsl:apply-templates rule to handle text nodes
|
||||
-- moved code base to Linux platform for default development environment
|
||||
|
||||
Build 19990818
|
||||
-- Added very simple support for xsl:number
|
||||
-- Added support for xsl:with-param
|
||||
-- Added more XPath support
|
||||
-- added operator precedence
|
||||
-- added and, or, <,<=,>=,>
|
||||
|
||||
|
||||
Build 19990816
|
||||
-- Changed focus from 19990709 to 19990813 XSLT Working Draft
|
||||
-- Made some changes for Borland C compatibility
|
||||
-- submitted by Stefan Heesch
|
||||
-- added xsl:copy-of
|
||||
-- fixed a bug with DOM Element, to allow DocumentFragments as children
|
||||
|
||||
Build 19990813
|
||||
-- added new example: identity.xml/xsl which tests:
|
||||
-- xsl:copy, node()
|
||||
-- added comment(), pi(), and node()
|
||||
-- XMLParser still needs to handle reading in XML comments
|
||||
-- added xsl:copy
|
||||
-- added xsl:processing-instruction
|
||||
-- added xsl:comment
|
||||
|
||||
Build 19990812
|
||||
-- Created base/Double.cpp (primitives.h)
|
||||
-- Based off some code submitted by Larry Fitzpatrick, changed Name from
|
||||
FloatPort to Double, I wanted to add more Double related methods
|
||||
-- changed the NaN() method to just a static double
|
||||
-- All expr classes now use Double::isNaN() and Double::NaN
|
||||
-- I added Double::isInfinite, Double::POSITIVE_INFINITY and
|
||||
Double::NEGATIVE_INFINITY
|
||||
-- Added base/Integer.cpp back into Makefile
|
||||
-- added Integer::toString(int,String);
|
||||
-- changed implementation
|
||||
-- Moved code to convert from Strings to doubles and from doubles to Strings
|
||||
into the Double class
|
||||
-- removed testdom.cpp from xml/dom
|
||||
-- Added more changes from Larry Fitzpatrick and Michele Lee for
|
||||
porting issues
|
||||
-- added appropriate return values for:
|
||||
-- xml/dom/Element.cpp
|
||||
-- xml/dom/NodeDefinition.cpp
|
||||
-- base/StringList.cpp
|
||||
-- xsl/expr/PredicateList.cpp
|
||||
-- Added remaining String Function Calls
|
||||
-- substring(), substring-after(), substring-before(), translate(),
|
||||
string-length()
|
||||
|
||||
|
||||
Build 19990810
|
||||
-- Added most of the Whitespace handling
|
||||
-- Added ErrorObserver interface
|
||||
-- ErrorObserver is now used throughout most of the code
|
||||
-- Added SimpleErrorObserver implementation of ErrorObserver
|
||||
-- Moved main() method from XSLProcessor.cpp to tranformiix.cpp
|
||||
-- Added the following XPath functions:
|
||||
-- local-part(), name(), namespace()
|
||||
-- see functions.xml/functions.xsl for available functions
|
||||
|
||||
Build 19990806
|
||||
-- Incoporated Changes From Larry Fitzpatrick
|
||||
-- Added more XPath functions
|
||||
-- last(), count(), string(), contains(), starts-with(), concat()
|
||||
-- see functions.xml/functions.xsl for available functions
|
||||
-- Added xsl:text support
|
||||
|
||||
|
@ -1,254 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Compiled Stylesheets</title>
|
||||
<style>
|
||||
.comment {
|
||||
font-style: italic;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>Compiled Stylesheets</h1>
|
||||
|
||||
<h2>Overview</h2>
|
||||
<p>
|
||||
There are 5 main entities: Stylesheet-loaders, stylesheet-compiler,
|
||||
stylesheet, execution-state and processor. The normal usecase is:
|
||||
<ol>
|
||||
<li>Set up a stylesheet-loader to read a resource.
|
||||
<li>Let it feed events to the stylesheet-compiler.
|
||||
<li>The compiler creates a stylesheet.
|
||||
<li>Init an execution-state with stylesheet, initial node, global
|
||||
parameters and an outputhandler factory.
|
||||
<li>Start the processor.
|
||||
</ol>
|
||||
</p>
|
||||
|
||||
<h2>Main classes</h2>
|
||||
<h3>txStylesheet</h3>
|
||||
<h4>Description:</h4>
|
||||
<p>
|
||||
This class represents a compiled stylesheet. If the stylesheet
|
||||
contains imported and/or included stylesheets they are all compiled
|
||||
into a single <code>txStylesheet</code>-object.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The stylesheet contains functions for getting the different top-level
|
||||
entities that exist in a stylesheet, such as attribute-sets, templates
|
||||
and global variables. The <code>txStylesheet</code> owns all objects
|
||||
in the stylesheet, including the instructions in templates and
|
||||
variables.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
A single <code>txStylesheet</code>-object can be used for multiple
|
||||
transformations, even running concurrently. Once a stylesheet is
|
||||
compiled it is never changed, nor does it carry any state.
|
||||
</p>
|
||||
|
||||
<h4>Typical functions:</h4>
|
||||
<pre>
|
||||
txInstruction* findTemplate(Node* aNode,
|
||||
const txExpandedName& aMode,
|
||||
txIMatchContext* aContext,
|
||||
ImportFrame* aImportedBy,
|
||||
ImportFrame** aImportFrame);
|
||||
txDecimalFormat* getDecimalFormat(const txExpandedName& aName);
|
||||
txInstruction* getAttributeSet(const txExpandedName& aName);
|
||||
txOutputFormat* getOutputFormat();
|
||||
</pre>
|
||||
|
||||
<h3>txStylesheetCompiler</h3>
|
||||
<h4>Description:</h4>
|
||||
<p>
|
||||
This class gets "events" from a stylesheet loader and creates a
|
||||
compiled stylesheet. The class calls back through a callback interface
|
||||
to the stylesheet-loader to load included and imported stylesheets.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The output from the <code>txStylesheetCompiler</code> is a
|
||||
ready-to-use <code>txStylesheet</code> object.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
To load included and imported stylesheets the
|
||||
<code>txStylesheetCompiler</code> calls the loader through a
|
||||
<code>txIIncludeLoaderCallback</code> interface suppling the url to
|
||||
load, and the <code>txStylesheetCompiler</code>-object that the loader
|
||||
should use to notify its events to. There is a separate
|
||||
<code>txStylesheetCompiler</code>-object for each sub-stylesheet,
|
||||
however only the initial <code>txStylesheetCompiler</code> will create
|
||||
a <code>txStylesheet</code>-object.
|
||||
</p>
|
||||
|
||||
<p class="comment">
|
||||
Do we want to refcount txIIncludeLoaderCallback? It might otherwise
|
||||
be hairy to deal with loads being cancled or failing.
|
||||
</p>
|
||||
|
||||
<h4>Typical functions:</h4>
|
||||
<pre>
|
||||
nsresult startElement(PRInt32 aNamespaceID, txAtom* aLocalName,
|
||||
txAtom* aPrefix, txStylesheetAttr* aAttributes,
|
||||
PRInt32 aAttrCount);
|
||||
nsresult endElement();
|
||||
nsresult characters(const String& aStr);
|
||||
nsresult doneLoading();
|
||||
void cancel(nsresult aError);
|
||||
</pre>
|
||||
|
||||
<h3>txHandlerTable</h3>
|
||||
<h4>Description:</h4>
|
||||
<p>
|
||||
To process the elements and textnodes in the stylesheet the
|
||||
<code>txStylesheetCompiler</code> calls different
|
||||
stylesheet-compile-handlers. Which handler to call is decided by two
|
||||
things:
|
||||
<ol>
|
||||
<li>The "mode" of the compiler, i.e. is it processing a top-level
|
||||
element? Is it processing the contents of a template? Is it
|
||||
processing the children of a xsl:attribute-set element?
|
||||
<li>The name and namespace of the element. (Of course, this doesn't
|
||||
apply to textnodes).
|
||||
</ol>
|
||||
The handlers are global static C-style functions. The handlers
|
||||
processes the elements and textnodes in the stylesheet and
|
||||
creates instructions and toplevel-items.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
To find which handler to call the compiler uses
|
||||
<code>txHandlerTable</code>-objects. The <code>txHandlerTable</code>
|
||||
contains a list of these stylesheet-compile-handlers keyed on
|
||||
element-name. It also contains a handler for text and a handler for
|
||||
LRE-elements.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
There are different <code>txHandlerTable</code>-objects for different
|
||||
"modes" of the compiler. There is one for handling top-level elements,
|
||||
one for handling template-parameters, one for handling the contents of
|
||||
a xsl:attribte-set element, one for handling the contents of
|
||||
unsupported extension-elements etc. The
|
||||
<code>txStylesheetCompiler</code> always has a current
|
||||
<code>txHandlerTable</code> which is used to find the handler to call.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The <code>txHandlerTable</code>s are initialized from static structs.
|
||||
This is to avoid having large pieces of code containing very similar
|
||||
code.
|
||||
</p>
|
||||
|
||||
<h4>Typical functions:</h4>
|
||||
<pre>
|
||||
nsresult init(txHandlerTableData* aTableData);
|
||||
txElementHandler* find(PRInt32 aNamespaceID, txAtom* aLocalName);
|
||||
</pre>
|
||||
|
||||
<h3>txStylesheetCompilerState</h3>
|
||||
<p class="comment">
|
||||
Do we want to rename this txStylesheetCompilerInternal?
|
||||
</p>
|
||||
<h4>Description:</h4>
|
||||
<p>
|
||||
This class manages the internal state of the
|
||||
<code>txStylesheetCompiler</code>. The reason that this is a separate
|
||||
class is so that the <code>txStylesheetCompiler</code> can keep a clean
|
||||
interface towards the stylesheet-loaders.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The <code>txStylesheetCompilerState</code>-class is used both by the
|
||||
<code>txStylesheetCompiler</code>-class and by the
|
||||
stylesheet-compile-handlers.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The class has three main purposes:
|
||||
<ul>
|
||||
<li>
|
||||
Keep track of the current context. Such as:
|
||||
<ul>
|
||||
<li>Namespace mappings.
|
||||
<li>Base-URI.
|
||||
<li>Extension-element namespaces.
|
||||
<li>Whitespace preservation mode.
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Store the state that the stylesheet-compile-handlers need. For
|
||||
example the current xsl:for-each loop to add xsl:sort-elements to.
|
||||
</li>
|
||||
<li>
|
||||
Keep track of the current <code>txHandlerTable</code>, so that the
|
||||
right stylesheet-compile-handler is called for elements and text.
|
||||
</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
This is the class that implements <code>txIParseContext</code> during
|
||||
all stylesheet-compilation.
|
||||
</p>
|
||||
|
||||
<h4>Typical functions:</h4>
|
||||
<pre>
|
||||
nsresult pushHandlerTable(txHandlerTable* aTable);
|
||||
nsresult parsePattern(const String& aPattern, txPattern** aResult);
|
||||
nsresult parseExpr(const String& aExpr, Expr** aResult);
|
||||
nsresult addToplevelItem(txToplevelItem* aItem);
|
||||
nsresult openInstructionContainer(txInstructionContainer* aContainer);
|
||||
nsresult addInstruction(txInstruction* aInstruction);
|
||||
</pre>
|
||||
|
||||
<h3>txExecutionState</h3>
|
||||
<h4>Description:</h4>
|
||||
<p>
|
||||
This class manages all state during the execution of a stylesheet.
|
||||
This includes
|
||||
<ul>
|
||||
<li>The current <code>txIEvalContext</code>.
|
||||
<li>The next <code>txInstruction</code> to be executed.
|
||||
<li>Variables that are in scope.
|
||||
<li>Values of global variables and keys.
|
||||
<li>Current result-handler.
|
||||
<li>Stylesheet being executed.
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The <code>txExecutionState</code> also acts as a general-purpose stack
|
||||
that instructions can use to communicate between each other. The class
|
||||
is the owner of this data and will delete it as appropriate if the
|
||||
execution aborts.
|
||||
</p>
|
||||
|
||||
<h4>Typical functions:</h4>
|
||||
<pre>
|
||||
nsresult pushEvalContext(txIEvalContext* aContext);
|
||||
txIEvalContext* popEvalContext();
|
||||
nsresult pushString(const nsAString& aStr);
|
||||
void popString(nsAString& aStr);
|
||||
txInstruction* getNextInstruction();
|
||||
nsresult runTemplate(txInstruction* aInstruction);
|
||||
void gotoInstruction(txInstruction* aNext);
|
||||
</pre>
|
||||
|
||||
<h3>txXSLTProcessor</h3>
|
||||
<h4>Description:</h4>
|
||||
<p>
|
||||
This is a fully static class that contains the main loop for executing
|
||||
a stylsheet.
|
||||
</p>
|
||||
|
||||
<h4>Typical functions:</h4>
|
||||
<pre>
|
||||
nsresult execute(txExecutionState& aEs);
|
||||
</pre>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,273 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>XSLT Templates and Compiling</title>
|
||||
<style type="text/css">
|
||||
.section {
|
||||
background-color: #cfcfcf;
|
||||
margin-left: 2em;
|
||||
}
|
||||
.required {
|
||||
font-weight: bold;
|
||||
}
|
||||
.TODO {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>XSLT Templates and Compiling</h1>
|
||||
<p>This document describes compiling of XSLT stylesheets and the
|
||||
evaluation of the result.</p>
|
||||
<div>
|
||||
<ul>
|
||||
<li><a href="#pre">Prerequisites</a></li>
|
||||
<li><a href="#comp">Compilation</a></li>
|
||||
<li><a href="#eval">Evaluation</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<h2><a name="pre">Objectives:</a></h2>
|
||||
<ul>
|
||||
<li>Speed</li>
|
||||
<li>Better support for AVTs</li>
|
||||
<li>Interruptability of processing</li>
|
||||
<li>exclude and alias namespaces</li>
|
||||
</ul>
|
||||
<h2>Concepts:</h2>
|
||||
<div>
|
||||
<dl>
|
||||
<dt>LRE namespaces</dt>
|
||||
<dd>All namespace aliases are merged wit import precedence
|
||||
into an array of all namespace ids, which is used to map the
|
||||
LRE namespace in the source to the LRE namespace in the
|
||||
result. Non-aliased namespaces just have their namespace id
|
||||
in that array.</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<h2><a name="comp">Compilation:</a></h2>
|
||||
<p>The XSLT specification describes XSLT in terms of the XPath
|
||||
datamodel, something pretty close to a DOM. So we talk about the
|
||||
input in terms of DOM elements.</p>
|
||||
<div>The DOM nodes in a stylesheet get compiled into either
|
||||
<ul>
|
||||
<li>nothing :-) (stuff like xsl:output),</li>
|
||||
<li><code>xslTopElement</code>s or</li>
|
||||
<li><code>xslInstruction</code>s.</li>
|
||||
</ul>
|
||||
The <code>xslInstruction</code>s fall into classes,
|
||||
<ol>
|
||||
<li>simple instructions,</li>
|
||||
<li>utilities (no-op, variable-pop, push-handler),</li>
|
||||
<li>branching instructions,</li>
|
||||
<li>instructions changing the result handler and</li>
|
||||
<li>instructions calling into different
|
||||
<code>xslTopElement</code>s.</li>
|
||||
</ol>
|
||||
</div>
|
||||
<h2><a name="eval">How do instructions work?</a></h2>
|
||||
<div>The general pattern used to create output from a set of
|
||||
instructions is
|
||||
<pre>while (instruction) {
|
||||
rv = instruction.do(args);
|
||||
if (NS_FAILED(rv)) {
|
||||
//cleanup
|
||||
return rv;
|
||||
}
|
||||
instruction = instruction.mNext;
|
||||
}</pre>
|
||||
This says pretty much all about simple and utility instructions.
|
||||
</div>
|
||||
<h3>Branching instructions</h3>
|
||||
<div>see <a href="#choose">xsl:choose</a>. The trailing single
|
||||
no-op helps in rejoining the paths, as that no-op can be created
|
||||
before the paths and thus easily appended to each end of the
|
||||
paths.</div>
|
||||
<h3>Instructions that change the output handler</h3>
|
||||
<div>These instructions (attribute, comment, pi creating text
|
||||
handlers, variable possibly creating a rtf handler) get created
|
||||
by inserting a push-handler-instruction into the workflow for
|
||||
the start of the element and the XSLT instruction at the
|
||||
end. The handler instruction should keep a non-owning reference
|
||||
to the push-handler-instruction to get the result and restore
|
||||
the previous handler.</div>
|
||||
|
||||
<h3><a name="apply-imports">xsl:apply-imports</a></h3>
|
||||
<div class="section">no idea</div>
|
||||
|
||||
<h3><a name="apply-templates">xsl:apply-templates</a></h3>
|
||||
<div class="section">
|
||||
<dl>
|
||||
<dt>members:</dt>
|
||||
<dd>
|
||||
<dl>
|
||||
<dt>select</dt> <dd>node-set-expression</dd>
|
||||
<dt>mode</dt> <dd>qname</dd>
|
||||
<dt>sorts</dt> <dd>list of xsl:sort elements</dd>
|
||||
<dt>params</dt> <dd>list of xsl:with-param elements</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
<dt>do()</dt>
|
||||
<dd>set up the params, if any, evaluate the select, create a
|
||||
evalContext and push it on the evalContextStack. push the next
|
||||
instruction to the instruction return stack. trigger the new
|
||||
context (how do we do this?).</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<h3><a name="attribute">xsl:attribute</a></h3>
|
||||
<div class="section">
|
||||
<dl>
|
||||
<dt>members:</dt>
|
||||
<dd>
|
||||
<dl>
|
||||
<dt class="required">name</dt> <dd>AVT with QName value</dd>
|
||||
<dt>namespace</dt> <dd>AVT with uri value</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
<dt>do()</dt>
|
||||
<dd>the start tag pushes a textValueHandler, the end tag pops
|
||||
the value handler and calls the outputhandler::attribute</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<h3><a name="attribute-set">xsl:attribute-set</a> (tle)</h3>
|
||||
<div class="section"><span class="TODO">attribute sets are merged,
|
||||
we should pay attention that multiple stylesheet compilers
|
||||
don't mix their content. Order of attributes is relevant, IMHO.</span>
|
||||
<dl>
|
||||
<dt>members:</dt>
|
||||
<dd>
|
||||
<dl>
|
||||
<dt class="required">name</dt> <dd>qname</dd>
|
||||
<dt>use-attribute-sets</dt> <dd>list of qnames</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
<dt>do()</dt>
|
||||
<dd>merging and stuff needed in the global stylesheet object,
|
||||
(NOT part of <a href="#import-frame">import frame).</a></dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<h3><a name="call-template">xsl:call-template</a></h3>
|
||||
<div class="section">
|
||||
<dl>
|
||||
<dt>members:</dt>
|
||||
<dd>
|
||||
<dl>
|
||||
<dt class="required">name</dt> <dd>qname</dd>
|
||||
<dt>with-params</dt> <dd>list of xsl:with-params</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
<dt>do()</dt>
|
||||
<dd>push the next instruction onto the instruction return
|
||||
stack, lookup the template and set the instruction pointer
|
||||
to the called template. Setup the params, if there are. This
|
||||
does not change the evalContextStack.
|
||||
<div class="issue">Can we cache this? What happens if a
|
||||
added stylesheet between two transforms changes which
|
||||
stylesheet this qname resolves to?</div></dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<h3><a name="choose">xsl:choose</a></h3>
|
||||
<div class="section">
|
||||
This is a branching instruction with one exit point and several
|
||||
conditional entry points (xsl:when) and one default
|
||||
(xsl:otherwise). The conditional entry points start with a
|
||||
conditionalGotoInstrunction, which jumps to the next entry point
|
||||
if they don't succeed. Each of them ends with a gotoInstruction
|
||||
that jumps to the end of the xsl:choose (for simplicity in the
|
||||
compilation phase, this might be a noopInstruction). The
|
||||
xsl:otherwise is just the instructions list of the
|
||||
xsl:otherwise, linked to the ending noopInstruction. Note that
|
||||
this construct a single instruction list for the complete
|
||||
xsl:choose, as the mNext of the final gotos is the next entry
|
||||
point. This mNext is only used for iterations, though.
|
||||
</div>
|
||||
|
||||
<h3><a name="comment">xsl:comment</a></h3>
|
||||
<div class="section">
|
||||
<dl>
|
||||
<dt>do()</dt>
|
||||
<dd>startElement pushes a textHandler, endElement takes the
|
||||
value and calls ::comment() in the output handler</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<h3><a name="copy">xsl:copy</a></h3>
|
||||
<div class="section">
|
||||
<dl>
|
||||
<dt>members:</dt>
|
||||
<dd></dd>
|
||||
<dt>do()</dt>
|
||||
<dd>xsl:copy has a <a
|
||||
href="#attribute-sets">use-attribute-sets</a> attribute,
|
||||
<span class="TODO">TODO</span></dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<h3><a name="copy-of">xsl:copy-of</a></h3>
|
||||
<div class="section">
|
||||
<dl>
|
||||
<dt>members:</dt>
|
||||
<dd>
|
||||
<dl>
|
||||
<dt class="required">select</dt>
|
||||
<dd>an expression to be added to the result tree</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
<dt>do()</dt>
|
||||
<dd>the value of the result is added to the result tree. If
|
||||
the result is a RTF, the RTF is just fed into the output
|
||||
handler, if the result is not a nodeset, it is converted
|
||||
into a string and ::characters is called on the output
|
||||
handler. For nodesets, the result is a list of source nodes
|
||||
which have to be interpreted, for example thru the
|
||||
stylesheet compiler. This has be xslt-blind, that is, xslt
|
||||
elements in the source must be treated as LRE elements and
|
||||
copied into the result, instead of generating XSLT
|
||||
instructions. <span class="TODO">is this all?</span></dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<h3><a name="decimal-format">xsl:decimal-format</a> (tle)</h3>
|
||||
<div class="section">xsl:decimal-format is stored in the global
|
||||
stylesheet object, import precedence <b>does not</b> apply.</div>
|
||||
|
||||
<h3><a name="element">xsl:element</a></h3>
|
||||
<div class="section">
|
||||
<dl>
|
||||
<dt>members:</dt>
|
||||
<dd>
|
||||
<dl>
|
||||
<dt class="required">name</dt> <dd>AVT with QName
|
||||
value</dd>
|
||||
<dt>namespace</dt> <dd>AVT with URI value</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
<dt>do()</dt>
|
||||
<dd>xsl:element has <a
|
||||
href="#attribute-sets">attribute-set</a>s, <span
|
||||
class="TODO">todo</span>. Other than that, this just
|
||||
generates an element. Note that the attributes of this
|
||||
element have to be discarded, if the name AVT does not
|
||||
evaluate to a QName.</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<h3><a name="fallback">xsl:fallback</a></h3>
|
||||
<div class="section"><span class="TODO">do we care?</span></div>
|
||||
|
||||
<h3><a name=""></a></h3>
|
||||
<div class="section">
|
||||
<dl>
|
||||
<dt>members:</dt>
|
||||
<dd></dd>
|
||||
<dt>do()</dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -1,376 +0,0 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Transformiix (TM) Contributors</TITLE>
|
||||
<META name="author" content="Keith Visco">
|
||||
</HEAD>
|
||||
<BODY Text="#000000" BGColor="#FFFFFF">
|
||||
<!-- OUTER TABLE -->
|
||||
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="640">
|
||||
<TR>
|
||||
<TD WIDTH="80"></TD>
|
||||
<TD WIDTH="560" COLSPAN="2" ALIGN="RIGHT">
|
||||
<B><FONT SIZE="+2">Transfor<FONT Color="blue">Mii</FONT>X</FONT></B>
|
||||
<SUP>TM</SUP>
|
||||
</TD>
|
||||
</TR>
|
||||
<TD WIDTH="80"><BR></TD>
|
||||
<TD WIDTH="560" COLSPAN="2">
|
||||
<!-- Contents -->
|
||||
<HR SIZE="1" />
|
||||
<BR/>
|
||||
<P>
|
||||
Much of the original <B>Transfor<FONT Color="blue">Mii</FONT>X</B> code was ported
|
||||
from <A HREF="http://www.clc-marketing.com/xslp">XSL:P</A>,
|
||||
an open source XSLT processor. Thanks to all the contributors of
|
||||
that project. TransforMiiX is now a whole new beast...thanks to all
|
||||
of the hard work of those listed below.
|
||||
<P>
|
||||
<P>
|
||||
<B>Core Developers</B><P>
|
||||
The following people have contributed substantial time and
|
||||
effort to the development.
|
||||
<TABLE WIDTH="100%" CELLSPACING="1">
|
||||
<TR BGColor="#EEEEEE"><TH>Name</TH><TH>Contribution</TH><TH>Company</TH></TR>
|
||||
<!-- Entry -->
|
||||
<TR BGColor="#EEEEEE">
|
||||
<TD VALIGN="TOP">
|
||||
<A href="mailto:kvisco@ziplink.net">Visco, Keith</a>
|
||||
</TD>
|
||||
<TD VALIGN="TOP" WIDTH="300">
|
||||
Software design, and most of the XSLT implementation and
|
||||
base classes implementation.
|
||||
</TD>
|
||||
<TD VALIGN="TOP">
|
||||
<A HREF="http://www.exoffice.com">Exoffice Technologies</A>
|
||||
<P>
|
||||
<FONT SIZE="-1">Formerly with The MITRE Corporation</FONT>.
|
||||
</TD>
|
||||
</TR>
|
||||
<!-- Entry -->
|
||||
<TR BGColor="#EEEEEE">
|
||||
<TD VALIGN="TOP">
|
||||
<A href="mailto:tomk@mitre.org">Kneeland, Tom</a>
|
||||
</TD>
|
||||
<TD>
|
||||
Software design, DOM Implementation. Handled the initial
|
||||
Mozilla integration and wrapper classes,
|
||||
String and String wrapper classes.
|
||||
</TD>
|
||||
<TD VALIGN="TOP">
|
||||
<A HREF="http://www.mitre.org">The MITRE Corporation</A>
|
||||
</TD>
|
||||
</TR>
|
||||
<!-- Entry -->
|
||||
<TR BGColor="#EEEEEE">
|
||||
<TD VALIGN="TOP">
|
||||
<A HREF="mailto:peter.vanderbeken@pandora.be">Van der Beken, Peter</A>
|
||||
</TD>
|
||||
<TD VALING="TOP" WIDTH="300">
|
||||
Leading the Transformiix/Mozilla integration,
|
||||
and Macintosh porting issues. Without Peter...we'd be doomed! :-)
|
||||
</TD>
|
||||
<TD VALIGN="TOP">
|
||||
<BR>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<!-- Entry -->
|
||||
<TR BGColor="#EEEEEE">
|
||||
<TD VALIGN="TOP">
|
||||
<A HREF="mailto:axel@pike.org">Hecht, Axel</A> (AKA - Pike)
|
||||
</TD>
|
||||
<TD WIDTH="300">
|
||||
Build issues...configure, Make, etc. Solaris porting issues.
|
||||
All nasty comments on regarding make files should now be directed to Pike!
|
||||
</TD>
|
||||
<TD VALIGN="TOP">
|
||||
<BR>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
</TABLE>
|
||||
</P>
|
||||
<P>
|
||||
<P>
|
||||
<B>Additional Developers</B><P>
|
||||
The following people have contributed to the development.
|
||||
<BR>(appearing in alphabetical order)
|
||||
<TABLE WIDTH="100%" CELLSPACING="1">
|
||||
<TR BGColor="#EEEEEE"><TH>Name</TH><TH>Contribution</TH><TH>Company</TH></TR>
|
||||
|
||||
<!-- Entry -->
|
||||
<TR BGColor="#EEEEEE">
|
||||
<TD VALIGN="TOP">
|
||||
<A HREF="mailto:arthur.barrett@march-hare.com">Barrett, Arthur</A>
|
||||
</TD>
|
||||
<TD WIDTH="300">
|
||||
Working on Windows makefiles.
|
||||
</TD>
|
||||
<TD VALIGN="TOP">
|
||||
<BR>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<!-- Entry -->
|
||||
<TR BGColor="#EEEEEE">
|
||||
<TD VALIGN="TOP">
|
||||
<A HREF="mailto:bbrown@solana.com">Brown, William Lewis</A>
|
||||
</TD>
|
||||
<TD WIDTH="300">
|
||||
Working with Marina on XSLT 1.0 conformity issues.
|
||||
</TD>
|
||||
<TD VALIGN="TOP">
|
||||
<BR>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<!-- Entry -->
|
||||
<TR BGColor="#EEEEEE">
|
||||
<TD VALIGN="TOP">
|
||||
<A HREF="mailto:duxy@leyou.com.cn">Du, Eric</A>
|
||||
</TD>
|
||||
<TD WIDTH="300">
|
||||
FreeBSD floating point porting issues
|
||||
</TD>
|
||||
<TD VALIGN="TOP">
|
||||
<BR>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<!-- Entry -->
|
||||
|
||||
<TR BGColor="#EEEEEE">
|
||||
<TD VALIGN="TOP">
|
||||
<A HREF="mailto:lef@opentext.com">Fitzpatrick, Larry</A>
|
||||
</TD>
|
||||
<TD WIDTH="300">
|
||||
Larry was the first contributor to the project. He sent
|
||||
a number of C++ porting issues with Visual C++,
|
||||
and has influenced some of the early design.
|
||||
</TD>
|
||||
<TD VALIGN="TOP">
|
||||
<A HREF="http://www.opentext.com">OpenText</A>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<!-- Entry -->
|
||||
<TR BGColor="#EEEEEE">
|
||||
<TD VALIGN="TOP">
|
||||
<A HREF="mailto:ogerardin@vo.lu">Gerardin, Olivier</A>
|
||||
</TD>
|
||||
<TD WIDTH="300">
|
||||
Implemented the XPath Number functions, the document()
|
||||
function, as well as some other changes/improvements.
|
||||
<FONT SIZE="-1">
|
||||
(see <A HREF="changes.txt">changes.txt</A> for more info)
|
||||
</FONT>
|
||||
</TD>
|
||||
<TD VALIGN="TOP">
|
||||
<A HREF="http://www.digitalwave.lu">DigitalWave</A>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<!-- Entry -->
|
||||
<TR BGColor="#EEEEEE">
|
||||
<TD VALIGN="TOP">
|
||||
<A HREF="mailto:rguarino@wavo.com">Guarino, Bobbi</A>
|
||||
</TD>
|
||||
<TD WIDTH="300">
|
||||
Solaris porting issues
|
||||
</TD>
|
||||
<TD VALIGN="TOP">
|
||||
<A HREF="http://www.wavo.com">Wavo Corporation</A>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
|
||||
<!-- Entry -->
|
||||
<TR BGColor="#EEEEEE">
|
||||
<TD VALIGN="TOP">
|
||||
<A HREF="mailto:Heesch@t-online.de">Heesch, Stefan</A>
|
||||
</TD>
|
||||
<TD WIDTH="300">
|
||||
C++ porting issues with Borland C
|
||||
</TD>
|
||||
<TD VALIGN="TOP">
|
||||
<BR><A HREF=""></A>
|
||||
</TD>
|
||||
</TR>
|
||||
<!-- Entry -->
|
||||
<TR BGColor="#EEEEEE">
|
||||
<TD VALIGN="TOP">
|
||||
<A HREF="mailto:joe@pwd.hp.com">Kuan, Joseph</A>
|
||||
</TD>
|
||||
<TD WIDTH="300">
|
||||
Sent changes for getting TransforMiiX to build on HPUX, SUNOS and AIX.
|
||||
<I>I still need to add these into the CVS.</I>
|
||||
</TD>
|
||||
<TD VALIGN="TOP">
|
||||
<A HREF="http://www.hp.com">Hewlett-Packard</A>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<!-- Entry -->
|
||||
<TR BGColor="#EEEEEE">
|
||||
<TD VALIGN="TOP">
|
||||
<A HREF="mailto:mclee@oblix.com">Lee, Michele</A>
|
||||
</TD>
|
||||
<TD WIDTH="300">
|
||||
C++ porting issues, bug reports
|
||||
</TD>
|
||||
<TD VALIGN="TOP">
|
||||
<A HREF="http://www.oblix.com">Oblix</A>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<!-- Entry -->
|
||||
<TR BGColor="#EEEEEE">
|
||||
<TD VALIGN="TOP">
|
||||
<A HREF="mailto:lidong@leyou.com.cn">Lidong</A>
|
||||
</TD>
|
||||
<TD WIDTH="300">
|
||||
Some Unicode bug fixes
|
||||
</TD>
|
||||
<TD VALIGN="TOP">
|
||||
<A HREF="http://www.leyou.com">Leyou.com</A>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<!-- Entry -->
|
||||
<TR BGColor="#EEEEEE">
|
||||
<TD VALIGN="TOP">
|
||||
<A HREF="mailto:mmarina@mindspring.com">Mechtcheriakova, Marina</A>
|
||||
</TD>
|
||||
<TD WIDTH="300">
|
||||
Contributed a number of bug fixes, as well as handling
|
||||
some conformity issues.
|
||||
</TD>
|
||||
<TD VALIGN="TOP">
|
||||
<BR>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<!-- Entry -->
|
||||
<TR BGColor="#EEEEEE">
|
||||
<TD VALIGN="TOP">
|
||||
<A HREF="mailto:kbob@oblix.com">Miller, Bob</A>
|
||||
</TD>
|
||||
<TD WIDTH="300">
|
||||
A number of bug fixes, C++ porting issues
|
||||
</TD>
|
||||
<TD VALIGN="TOP">
|
||||
<A HREF="http://www.oblix.com">Oblix</A>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<!-- Entry -->
|
||||
<TR BGColor="#EEEEEE">
|
||||
<TD VALIGN="TOP">
|
||||
<A HREF="mailto:andreas.otte@primus-online.de">Otte, Andreas</A>
|
||||
</TD>
|
||||
<TD WIDTH="300">
|
||||
Helping Axel with build issues...configure, make files, etc.
|
||||
</TD>
|
||||
<TD VALIGN="TOP">
|
||||
<BR>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<!-- Entry -->
|
||||
<TR BGColor="#EEEEEE">
|
||||
<TD VALIGN="TOP">
|
||||
<A HREF="mailto:npride@wavo.com">Pride, Nathan</A>
|
||||
</TD>
|
||||
<TD WIDTH="300">
|
||||
Solaris porting issues, some general bug fixes
|
||||
</TD>
|
||||
<TD VALIGN="TOP">
|
||||
<A HREF="http://www.wavo.com">Wavo Corporation</A>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<!-- Entry -->
|
||||
<TR BGColor="#EEEEEE">
|
||||
<TD VALIGN="TOP">
|
||||
<A HREF="mailto:jjs@acis.com.au">Smith, Justin</A>
|
||||
</TD>
|
||||
<TD WIDTH="300">
|
||||
Working on Windows Makefiles.
|
||||
</TD>
|
||||
<TD VALIGN="TOP">
|
||||
<BR>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
|
||||
|
||||
</TABLE>
|
||||
|
||||
<P><B>Testing/Feedback (Suggestions/Bug Reports)</B><P>
|
||||
The following people have used TransforMiiX and provided feedback that has been
|
||||
beneficial to the development.
|
||||
<BR>(appearing in alphabetical order)
|
||||
<TABLE BORDER="0" WIDTH="100%">
|
||||
<TR BGColor="#EEEEEE"><TD><B>Name</B></TD><TD><B>Company</B></TD></TR>
|
||||
|
||||
<!-- Entry -->
|
||||
<TR BGColor="#EEEEEE">
|
||||
<TD><A HREF="mailto:jbailey@nisa.net">Bailey, Jeff</A></TD>
|
||||
<TD><BR></TD>
|
||||
</TR>
|
||||
|
||||
<!-- Entry -->
|
||||
<TR BGColor="#EEEEEE">
|
||||
<TD><A HREF="mailto:bbrown@solana.com">Brown, William Lewis</A></TD>
|
||||
<TD><BR></TD>
|
||||
</TR>
|
||||
|
||||
<!-- Entry -->
|
||||
<TR BGColor="#EEEEEE">
|
||||
<TD><A HREF="mailto:tlebouil@lucent.com">Le Bouil, Thierry</A></TD>
|
||||
<TD><A HREF="http://www.lucent.com">Lucent Technologies, Inc.</A></TD>
|
||||
</TR>
|
||||
|
||||
<!-- Entry -->
|
||||
<TR BGColor="#EEEEEE">
|
||||
<TD><A HREF="mailto:schefer@xo3.com">Schefer, Marc</A></TD>
|
||||
<TD><BR></TD>
|
||||
</TR>
|
||||
|
||||
<!-- Entry -->
|
||||
<TR BGColor="#EEEEEE">
|
||||
<TD><A HREF="mailto:stinney@sas.upenn.edu">Tinney, Steve</A></TD>
|
||||
<TD><A HREF="http://www.upenn.com">University of Pennsylvania</A></TD>
|
||||
<!-- Comments: UTF8 bug report -->
|
||||
</TR>
|
||||
|
||||
<!-- Entry -->
|
||||
<TR BGColor="#EEEEEE">
|
||||
<TD><A HREF="mailto:jiwei.wang@saraide.com">Wang, Jiwei</A></TD>
|
||||
<TD><BR></TD>
|
||||
</TR>
|
||||
|
||||
<!-- Entry -->
|
||||
<TR BGColor="#EEEEEE">
|
||||
<TD>
|
||||
<A HREF="mailto:bzwische@email.archlab.tuwien.ac.at">
|
||||
Zwischenbrugger, Bernhard</A>
|
||||
</TD>
|
||||
<TD><BR></TD>
|
||||
</TR>
|
||||
|
||||
</TABLE>
|
||||
<!-- End Contents -->
|
||||
|
||||
<!-- Footer -->
|
||||
<HR SIZE="1">
|
||||
<FONT SIZE="-1">
|
||||
The MITRE Corporation, Keith Visco (C) Copyright 1999-2000, All rights reserved<BR>
|
||||
Email:<A HREF="mailto:kvisco@ziplink.net">kvisco@ziplink.net</A>
|
||||
</FONT>
|
||||
<!-- End Footer -->
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<!-- End Outer Table -->
|
||||
</HTML>
|
@ -1,199 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Optimizing Stylesheets</title>
|
||||
<style>
|
||||
.comment {
|
||||
font-style: italic;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>Optimizing Stylesheets</h1>
|
||||
|
||||
<h2>Overview</h2>
|
||||
<p>
|
||||
This document outlines optimizations that we can perform on
|
||||
stylesheets after a stylesheet is compiled, but before it is executed.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>Create AVTs out of xsl:attributes</h2>
|
||||
<p>
|
||||
People often write stylesheets like
|
||||
<pre>
|
||||
<LRE>
|
||||
<xsl:attribute name="foo">
|
||||
text here
|
||||
<xsl:value-of select="@bar"/>
|
||||
</xsl:attribute>
|
||||
</pre>
|
||||
This could be optimized into an AVT like
|
||||
<pre>
|
||||
<LRE foo="text here{@foo}">
|
||||
</pre>
|
||||
This can be done both in templates and in attribute-sets
|
||||
</p>
|
||||
|
||||
|
||||
<h2>Investigate how RTFs are being used</h2>
|
||||
<p>
|
||||
When only the string-value or double-value of an RTF is being used it
|
||||
is unneccesary to create an entire RTF. Instead we could set up a
|
||||
string-handler and use the resulting string.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Once we have a node-set() function we could also have a special
|
||||
handler that creates that resulting nodeset rather then
|
||||
whatever-we-create-once-we-have-real-RTFs. That handler would be set
|
||||
up when we can determain that a RTF is used only as argument to the
|
||||
node-set() function.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
In cases where an RTF is used as parameter in a call to another
|
||||
template we could do further analysis to see how that parameter is
|
||||
used in that template. Either by first analyzing how all template
|
||||
parameters are used in all templates, or by recursivly searching
|
||||
the called template when we find that a RTF is used as an argument.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
We will still need a catch-all RTF implementation that is used when
|
||||
we can't determin how a variable is used, or when it is used in
|
||||
multiple different ways.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>Inline/calculate constant variables</h2>
|
||||
<p>
|
||||
Variables that does not have a value that depends on the source
|
||||
document can be inlined into the stylesheet. The value of these
|
||||
variables could also be calculated before the transformation is
|
||||
started.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
This can be combined with the previous optimization of RTFs so that
|
||||
stylesheets like
|
||||
<pre>
|
||||
<xsl:variable name="v">_</xsl:variable>
|
||||
...
|
||||
<xsl:value-of select="concat(@id, $v, foo)"/>
|
||||
</pre>
|
||||
is executed like
|
||||
<pre>
|
||||
<xsl:value-of select="concat(@id, '_', foo)"/>
|
||||
</pre>
|
||||
<p>
|
||||
|
||||
<p>
|
||||
This can be done for both global and local variables.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>Resolve cross-references</h2>
|
||||
<p>
|
||||
Cross-references to named templates, attribute-sets and template-modes
|
||||
can be resolved before the stylesheet is executed. That way we don't
|
||||
have to search for the template/attribute-set with a certain name, or
|
||||
the group of templates for a certain mode.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Note that for apply-imports we won't always know at compile-time which
|
||||
mode to seach for templates in.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>Resolve variables by index rather then expanded name</h2>
|
||||
<p>
|
||||
Rather then seaching for variables with a certain name at runtime
|
||||
we could remove names for variables/parameters entierly and put all
|
||||
variables in an array (possibly a separate array for global variables)
|
||||
and then let variable-references in expressions just point to an index
|
||||
in that array.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>Calculate and use constant AVTs</h2>
|
||||
<p>
|
||||
A lot of instruction-elements uses AVTs that often are constants in
|
||||
stylesheets, such as the data-type parameter to xsl:sort. For xsl:sort
|
||||
we could pre-create a finished nodesorter if all AVTs in all
|
||||
xsl:sort-elements are constant.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Another example is xsl:element and xsl:attribute where we could use
|
||||
LRE-instructions if the AVTs are constant. For xsl:number we could
|
||||
create prepare the list of <code>txFormattedCounter</code>s.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>Reuse parameter-map if exact same parameters are used</h2>
|
||||
<p>
|
||||
If a template calls another template and uses the exact same
|
||||
parameters we can reuse the same parameter-map.
|
||||
<pre>
|
||||
<xsl:template name="hsbc_html_body">
|
||||
<xsl:param name="appName"/>
|
||||
<xsl:param name="title"/>
|
||||
<body>
|
||||
<xsl:call-template name="hsbc_form">
|
||||
<xsl:with-param name="appName" select="$appName"/>
|
||||
<xsl:with-param name="title" select="$title"/>
|
||||
</xsl:call-template>
|
||||
</body>
|
||||
</xsl:template>
|
||||
</pre>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
We have to watch out for default parameter-values as well as
|
||||
parameters being specified by the caller of this template but not used
|
||||
by this template. I.e. if the parameter "hello" is specified when
|
||||
calling the above template.
|
||||
</p>
|
||||
|
||||
<p class="comment">
|
||||
All this might make this optimization useless.
|
||||
</p>
|
||||
|
||||
<h2>Combind consecutive LRE items into a txResultBuffer</h2>
|
||||
<p>
|
||||
When a template contains several consecutive "LRE instructions" such
|
||||
as LRE-elements, LRE-attributes and textnodes we can replace their
|
||||
instructions with a special instruction that contains a
|
||||
<code>txResultBuffer</code>. This buffer would then be flushed when
|
||||
the instruction is executed. This can of course not be done for
|
||||
LRE-attributes that contains AVTs. Even PI and comment-instructions
|
||||
can be included in this buffer if their contents is strictly literal.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The result is that a template like
|
||||
<pre>
|
||||
<xsl:template match="/">
|
||||
<html>
|
||||
<body bgcolor="green">
|
||||
Here goes pagecontent
|
||||
<xsl:apply-templates />
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
</pre>
|
||||
Would result in the first <code>txResultBuffer</code> to contain the
|
||||
following transactions: eStartElementTransaction,
|
||||
eStartElementTransaction, eAttributeTransaction, eCharacterTransaction.
|
||||
</p>
|
||||
|
||||
<p class="comment">
|
||||
There is probably a lower limit to when it's worth the effort to
|
||||
replace the normal instructions with the buffer-instruction. A single
|
||||
"LRE instruction" is probobably better kept as a normal instruction.
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,523 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Optimizing XPath</title>
|
||||
<style>
|
||||
.comment {
|
||||
font-style: italic;
|
||||
}
|
||||
h4 {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>Optimizing XPath</h1>
|
||||
|
||||
<h2>Overview</h2>
|
||||
<p>
|
||||
This document outlines optimizations that we can perform to execute
|
||||
xpath-expressions faster.
|
||||
</p>
|
||||
|
||||
<h2>Stage 1, <a href="http://bugzilla.mozilla.org/show_bug.cgi?id=94471">DONE</a></h2>
|
||||
|
||||
<h3>Summary</h3>
|
||||
<p>
|
||||
Speed up retrieval of orderInfo objects by storing them in resp.
|
||||
node instead of in a hash.
|
||||
</p>
|
||||
|
||||
<h3>Details</h3>
|
||||
<p>
|
||||
We currently spend a GREAT deal of time looking through a
|
||||
DOMHelper::orders hash looking for the orderInfo object for a
|
||||
specific node. If we moved the ownership and retrieval of these
|
||||
orderInfo objects to the Node class instead we will probably save
|
||||
a lot of time. I.E. instead of calling
|
||||
<code>myDOMHelper->getDocumentOrder(node)</code> you call
|
||||
<code>node->getDocumentOrder()</code> which then returns the
|
||||
orderInfo object.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
It would also be nice if we at the same time fixed some bugs wrt the
|
||||
orderInfo objects and the function that sorts nodes using them.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Bugs filed at this are 88964 and 94471
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
<h2>Stage 2, <a href="http://bugzilla.mozilla.org/show_bug.cgi?id=85893">DONE</a></h2>
|
||||
|
||||
|
||||
<h3>Summary</h3>
|
||||
<p>
|
||||
Speed up document-order sorting by having the XPath engine always
|
||||
return document-ordered nodesets.
|
||||
</p>
|
||||
|
||||
<h3>Details</h3>
|
||||
<p>
|
||||
Currently the nodesets returned from the XPath engine are totally
|
||||
unordered (or rather, have undefined order) which forces the XSLT
|
||||
code to sort the nodesets. This is quite expensive since it requires
|
||||
us to generate orderInfo objects for every node. Considering that
|
||||
many XPath classes actually returns nodesets that are already
|
||||
ordered in document order (or reversed document order) this seems a
|
||||
bit unnecessary.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
However we still need to handle the classes that don't by default
|
||||
return document-ordered nodesets. A good example of this is the id()
|
||||
function. For example "id('foo bar')" produces two nodes which the
|
||||
id-function has no idea how they relate in terms of document order.
|
||||
Another example is "foo | bar", where the UnionExpr object gets two
|
||||
nodesets (ordered in document order since all XPath classes should
|
||||
now return ordered nodesets) and need to merge them into a single
|
||||
ordered nodeset.
|
||||
</p>
|
||||
|
||||
<h2>Stage 3, <a href="http://bugzilla.mozilla.org/show_bug.cgi?id=205703">DONE</a></h2>
|
||||
|
||||
<h3>Summary</h3>
|
||||
<p>
|
||||
Refcount <code>ExprResult</code>s to reduce the number of objects
|
||||
created during evaluation.
|
||||
</p>
|
||||
|
||||
<h3>Details</h3>
|
||||
<p>
|
||||
Right now every subexpression creates a new object during evaluation.
|
||||
If we refcounted objects we would be often be able to reuse the same
|
||||
objects across multiple evaluations. We should also keep global
|
||||
result-objects for true and false, that way expressions that return
|
||||
bool-values would never have to create any objects.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
This does however require that the returned objects arn't modified
|
||||
since they might be used elsewhere. This is not a big problem in the
|
||||
current code where we pretty much only modify nodesets in a couple
|
||||
of places.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
To be able to reuse objects across subexpressions we chould have an
|
||||
<code>ExprResult::ensureModifyable</code>-function. This would
|
||||
return the same object if the refcount is 1, and create a new object
|
||||
to return otherwise. This is especially usefull for nodesets which
|
||||
would be mostly used by a single object at a time. But it could be
|
||||
just as usefull for other types, though then we might need a
|
||||
<code>ExprResult::ensureModifyableOfType(ExprResult::ResultType)</code>-function
|
||||
that only returned itself if it has a refcount of 1 and is of the
|
||||
requsted type.
|
||||
</p>
|
||||
|
||||
<h2>Stage 4</h2>
|
||||
|
||||
<h3>Summary</h3>
|
||||
<p>
|
||||
Speed up evaluation of XPath expressions by using specialized
|
||||
classes for common optimizable expressions.
|
||||
</p>
|
||||
|
||||
<h3>Details</h3>
|
||||
<p>
|
||||
Some common expressions are possible to execute faster if we have
|
||||
classes that are specialized for them. For example the expression
|
||||
"@foo" can be evaluated by simply calling |context->getAttributeNode
|
||||
("foo")|, instead we now walk all attributes of the context node and
|
||||
filter each node using a AttributeExpr. Below is a list of
|
||||
expressions that I can think of that are optimizable, but there are
|
||||
probably more.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
One thing that we IMHO should keep in mind is to only put effort on
|
||||
optimising expressions that are actually used in realworld
|
||||
stylesheets. For example "foo | foo", "foo | bar[0]" and
|
||||
"foo[position()]" can all be optimised to "foo", but since noone
|
||||
should be so stupid as to write such an expression we shouldn't
|
||||
spend time or codesize on that. Of course we should return the
|
||||
correct result according to spec for those expressions, we just
|
||||
shouldn't bother with evaluating them fast.
|
||||
</p>
|
||||
|
||||
|
||||
<p>
|
||||
Apart from finding expression that we can evaluate more cleverly
|
||||
there is also the problem of how and where do we create these
|
||||
optimised objects instead of the unoptimised, general ones we create
|
||||
now. And what are these optimised classes, should they be normal
|
||||
Expr classes or should they be something else? We could also add
|
||||
"optional" methods to Expr which have default implementations in
|
||||
Expr, for example a ::isContextSensitive() which returns MB_TRUE
|
||||
unless overridden. However we probably can't answer all this until
|
||||
we know which expressions we want to optimised and how we want to
|
||||
optimise them.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
These expressions can be optimised:
|
||||
</p>
|
||||
|
||||
<p><h4><a name="usecase01" href="#usecase01">Use case 1</a></h4>
|
||||
<h4>Class:</h4>
|
||||
Steps along the attribute axis which doesn't contain wildcards
|
||||
<h4>Example:</h4>
|
||||
@foo
|
||||
<h4>What we do today:</h4>
|
||||
Walk through the attributes NamedNodeMap and filter each node using a
|
||||
NameTest.
|
||||
<h4>What we could do:</h4>
|
||||
Call getAttributeNode (or actually getAttributeNodeNS) on the
|
||||
contextnode and return a nodeset containing just the returned node, or
|
||||
an empty nodeset if NULL is returned.
|
||||
</p>
|
||||
|
||||
<p><h4><a name="usecase02" href="#usecase02">Use case 2</a></h4>
|
||||
<h4>Class:</h4>
|
||||
Union expressions where each expression consists of a LocationStep and
|
||||
all LocationSteps have the same axis. None of the LocationSteps have any
|
||||
predicates (well, this could be relaxed a bit)
|
||||
<h4>Example:</h4>
|
||||
foo | bar | baz
|
||||
<h4>What we do today:</h4>
|
||||
Evaluate each LocationStep separately and thus walk the same path through
|
||||
the document each time. During the walking the NodeTest is applied to
|
||||
filter out the correct nodes. The resulting nodesets are then merged and
|
||||
thus we generate orderInfo objects for most nodes.
|
||||
<h4>What we could do:</h4>
|
||||
Have just one LocationStep object which contains a NodeTest that is a
|
||||
"UnionNodeTest" which contains a list of NodeTests. The UnionNodeTest
|
||||
then tests each NodeTest until it finds one that returns true. If none
|
||||
do then false is returned.
|
||||
This results in just one walk along the axis and no need to generate any
|
||||
orderInfo objects.
|
||||
</p>
|
||||
|
||||
<p><h4><a name="usecase03" href="#usecase03">Use case 3</a></h4>
|
||||
<h4>Class:</h4>
|
||||
Steps where the predicates isn't context-node-list sensitive.
|
||||
<h4>Example:</h4>
|
||||
foo[@bar]
|
||||
<h4>What we do today:</h4>
|
||||
Build a nodeset of all nodes that match 'foo' and then filter the
|
||||
nodeset through the predicate and thus do some node shuffling.
|
||||
<h4>What we could do:</h4>
|
||||
Create a "PredicatedNodeTest" that contains a NodeTest and a list of
|
||||
predicates. The PredicatedNodeTest returns true if both the NodeTest
|
||||
returns true and all predicats evaluate to true. Then let the
|
||||
LocationStep have that PredicateNodeTest as NodeTest and no predicates.
|
||||
This will save us the predicate filtering and thus some node shuffling.
|
||||
(Note how this combines nicely with the previous optimisation...)
|
||||
(Actually this can be done even if some predicates are context-list
|
||||
sensitive, but only up until the first that isn't.)
|
||||
</p>
|
||||
|
||||
<p><h4><a name="usecase04" href="#usecase04">Use case 4</a></h4>
|
||||
<h4>Class:</h4>
|
||||
PathExprs that only contains steps that from the child:: and attribute::
|
||||
axes.
|
||||
<h4>Example:</h4>
|
||||
foo/bar/baz
|
||||
<h4>What we do today:</h4>
|
||||
For each step we evaluate the step once for every node in a nodeset
|
||||
(for example for the second step the nodeset is the list of all "foo"
|
||||
children) and then merge the resulting nodesets while making sure that
|
||||
we keep the nodes in document order (and thus generate orderInfo
|
||||
objects).
|
||||
<h4>What we could do:</h4>
|
||||
The same thing except that we don't merge the resulting nodeset, but
|
||||
rather just concatenate them. We always know that the resulting nodesets
|
||||
are after each other in node order.
|
||||
</p>
|
||||
|
||||
<p><h4><a name="usecase05" href="#usecase05">Use case 5</a></h4>
|
||||
<h4>Class:</h4>
|
||||
List of predicates where some predicate are not context-list sensitive
|
||||
<h4>Example:</h4>
|
||||
foo[position() > 3][@bar][.//baz][position() > size() div 2][.//@fud]
|
||||
<h4>What we do today:</h4>
|
||||
Apply each predicate separately requiring us to shuffle nodes five times
|
||||
in the above example.
|
||||
<h4>What we could do:</h4>
|
||||
Merge all predicates that are not node context-list sensitive into the
|
||||
previous predicate. The above predicate list could be merged into the
|
||||
following predicate list
|
||||
foo[(position() > 3) and (@bar) and (.//baz)][(position() > size() div 2) and (.//@fud)]
|
||||
Which only requires two node-shuffles
|
||||
</p>
|
||||
|
||||
<p><h4><a name="usecase06" href="#usecase06">Use case 6</a></h4>
|
||||
<h4>Class:</h4>
|
||||
Predicates that are only context-list-position sensitive and not
|
||||
context-list-size sensitive
|
||||
<h4>Example:</h4>
|
||||
foo[position() > 5][position() mod 2]
|
||||
<h4>What we do today:</h4>
|
||||
Build the entire list of nodes that matches "foo" and then apply the
|
||||
predicates
|
||||
<h4>What we could do:</h4>
|
||||
Apply the predicates during the initial build of the first nodeset. We
|
||||
would have to keep track of how many nodes has passed each and somehow
|
||||
override the code that calculates the context-list-position.
|
||||
</p>
|
||||
|
||||
<p><h4><a name="usecase07" href="#usecase07">Use case 7</a></h4>
|
||||
<h4>Class:</h4>
|
||||
Predicates that are constants
|
||||
<h4>Example:</h4>
|
||||
foo[5]
|
||||
<h4>What we do today:</h4>
|
||||
Perform the appropriate walk and build the entire nodeset. Then apply
|
||||
the predicate.
|
||||
<h4>What we could do:</h4>
|
||||
There are three types of constant results; 1) Numerical values 2)
|
||||
Results with a true boolean-value 3) Results with a false boolean value.
|
||||
In the case of 1) we should only step up until the n:th node (5 in above
|
||||
example) and then stop. For 2) we should completely ignore the predicate
|
||||
and for 3) we should return an empty nodeset without doing any walking.
|
||||
In some cases we can't at parsetime decide if a constant expression will
|
||||
return a numerical or not, for example for "foo[$pos]", so the decision
|
||||
of 1) 2) or 3) would have to be made at evaltime. However we should be
|
||||
able to decide if it's a constant or not at parsetime.
|
||||
Note that while evaluating a LocationStep [//foo] can be considered
|
||||
constant.
|
||||
</p>
|
||||
|
||||
<p><h4><a name="usecase08" href="#usecase08">Use case 8</a></h4>
|
||||
<h4>Class:</h4>
|
||||
PathExprs that contains '//' followed by an unpredicated child-step.
|
||||
<h4>Example:</h4>
|
||||
.//bar
|
||||
<h4>What we do today:</h4>
|
||||
We walk the entire subtree below the contextnode and at every node we
|
||||
evaluate the 'bar'-expression which walks all the children of the
|
||||
contextnode. This means that we'll walk the entire subtree twice.
|
||||
<h4>What we could do:</h4>
|
||||
Change the expression into "./descendant::bar". This means that we'll
|
||||
only walk the tree once. This can only be done if there are no
|
||||
predicates since the context-node-list will be different for
|
||||
predicates in the new expression.
|
||||
Note that this combines nicely with the "Steps where the predicates
|
||||
isn't context-node-list sensitive" optimization.
|
||||
</p>
|
||||
|
||||
<p><h4><a name="usecase09" href="#usecase09">Use case 9</a></h4>
|
||||
<h4>Class:</h4>
|
||||
PathExprs where the first step is '.'
|
||||
<h4>Example:</h4>
|
||||
./*
|
||||
<h4>What we do today:</h4>
|
||||
Evaluate the step "." which always returns the same node and then
|
||||
evaluate the rest of the PathExpr.
|
||||
<h4>What we could do:</h4>
|
||||
Remove the '.'-step and simply evaluate the other steps. In the example
|
||||
we could even remove the entire PathExpr-object and replace it with a
|
||||
single Step-object.
|
||||
</p>
|
||||
|
||||
<p><h4><a name="usecase10" href="#usecase10">Use case 10</a></h4>
|
||||
<h4>Class:</h4>
|
||||
Steps along the attribute axis which doesn't contain wildcards and
|
||||
we only care about the boolean value.
|
||||
<h4>Example:</h4>
|
||||
foo[@bar], @foo or @bar
|
||||
<h4>What we do today:</h4>
|
||||
Evaluate the step and create a nodeset. Then get the bool-value of
|
||||
the nodeset by checking if the nodeset contain any nodes.
|
||||
<h4>What we could do:</h4>
|
||||
Simply check if the current element has an attribute of the
|
||||
requested name and return a bool-result.
|
||||
</p>
|
||||
|
||||
<p><h4><a name="usecase11" href="#usecase11">Use case 11</a></h4>
|
||||
<h4>Class:</h4>
|
||||
Unpredicated steps where we only care about the boolean value.
|
||||
<h4>Example:</h4>
|
||||
foo[<u>processing-instruction()</u>]
|
||||
<h4>What we do today:</h4>
|
||||
Evaluate the step and create a nodeset. Then get the bool-value of
|
||||
the nodeset by checking if the nodeset contain any nodes.
|
||||
<h4>What we could do:</h4>
|
||||
Walk along the axis until we find a node that matches the nodetest.
|
||||
If one is found we can stop the walking and return a true
|
||||
bool-result immediatly, otherwise a false bool-result is returned.
|
||||
It might not be worth implementing all axes unless we can reuse
|
||||
code from the normal Step-code. This could also be applied to
|
||||
<code>PathExpr</code>s by getting the boolvalue of the last step.
|
||||
</p>
|
||||
|
||||
<p><h4><a name="usecase12" href="#usecase12">Use case 12</a></h4>
|
||||
<h4>Class:</h4>
|
||||
Unpredicated steps where we only care about the string-value.
|
||||
<h4>Example:</h4>
|
||||
starts-with(<u>processing-instruction()</u>, 'hello')
|
||||
<h4>What we do today:</h4>
|
||||
Evaluate the step and create a nodeset. Then get the string-value of
|
||||
the nodeset by getting the stringvalue of the first node.
|
||||
<h4>What we could do:</h4>
|
||||
Walk along the axis until we find a node that matches the nodetest.
|
||||
If one is found we can stop the walking and return a string-result
|
||||
containing the value of that node. Otherwise an empty string-result
|
||||
can be returned.<br>
|
||||
This can also be done when we only care about the number-value.<br>
|
||||
This could be combined with the "Unpredicated steps where we only
|
||||
care about the boolean value" optimization by instead of returning
|
||||
a bool-value or string-value return a nodeset containing just the
|
||||
found node. If that is done this optimization could be applied to
|
||||
<code>PathExpr</code>s.
|
||||
</p>
|
||||
|
||||
<p><h4><a name="usecase13" href="#usecase13">Use case 13</a></h4>
|
||||
<h4>Class:</h4>
|
||||
Expressions where the value of an attribute is compared to
|
||||
a literal.
|
||||
<h4>Example:</h4>
|
||||
@bar = 'value'
|
||||
<h4>What we do today:</h4>
|
||||
Evaluate the attribute-step and then compare the resulting nodeset
|
||||
to the value.
|
||||
<h4>What we could do:</h4>
|
||||
Get the attribute-value for the element and compare that directly
|
||||
to the value. In the above example we would just call
|
||||
<code>getAttr('bar', kNameSpaceID_None)</code> and compare the
|
||||
resulting string with 'value'.
|
||||
</p>
|
||||
|
||||
<p><h4><a name="usecase14" href="#usecase14">Use case 14</a></h4>
|
||||
<h4>Class:</h4>
|
||||
PathExprs where the last step has a predicate that is not
|
||||
context-nodeset dependent and that contains a part that is not
|
||||
context-node dependent.
|
||||
<h4>Example:</h4>
|
||||
foo/*[@bar = current()/@bar]
|
||||
<h4>What we do today:</h4>
|
||||
<h4>What we could do:</h4>
|
||||
First evaluate "foo/*" and "current()/@bar". Then replace
|
||||
"current()/@bar" with a literal (and possibly optimize) and filter
|
||||
all nodes in the nodeset from "foo/*".
|
||||
</p>
|
||||
|
||||
<p><h4><a name="usecase15" href="#usecase15">Use case 15</a></h4>
|
||||
<h4>Class:</h4>
|
||||
local-name() or namespace-uri() compared to a literal
|
||||
<h4>Example:</h4>
|
||||
local-name() = 'foo'
|
||||
<h4>What we do today:</h4>
|
||||
evaluate the local-name function and compare the string-result to
|
||||
the string-result of the literal.
|
||||
<h4>What we could do:</h4>
|
||||
Atomize the literal (or get the namespaceID in case of
|
||||
namespace-uri()) and then compare that to the atom-name of the
|
||||
contextnode. This is primarily usefull when combined with the
|
||||
previous class.
|
||||
</p>
|
||||
|
||||
<p><h4><a name="usecase16" href="#usecase16">Use case 16</a></h4>
|
||||
<h4>Class:</h4>
|
||||
Comparisons where one side is a nodeset and the other is not a
|
||||
bool-value.
|
||||
<h4>Example:</h4>
|
||||
//myElem = @baz
|
||||
<h4>What we do today:</h4>
|
||||
Evaluate both sides and then compare them according to the spec.
|
||||
<h4>What we could do:</h4>
|
||||
First of all we should start by evaluating the nodeset-side, if the
|
||||
result is an empty nodeset false can be returned immediatly.
|
||||
Otherwise we evaluate as normal. When both sides are nodesets we
|
||||
should examine them and try to figure out which is faster to
|
||||
evaluate. That expression should be evaluated first (probably
|
||||
by making it the left-hand-side expression).
|
||||
</p>
|
||||
|
||||
<p><h4><a name="usecase17" href="#usecase17">Use case 17</a></h4>
|
||||
<h4>Class:</h4>
|
||||
Comparisons where one side is a PathExpr and the other is a
|
||||
bool-value.
|
||||
<h4>Example:</h4>
|
||||
baz = ($foo > $bar)
|
||||
<h4>What we do today:</h4>
|
||||
Evaluate both sides and then compare them.
|
||||
<h4>What we could do:</h4>
|
||||
Apply the "Steps where we only care about the boolean
|
||||
value"-optimization on the PathExpr-side and then evaluate as usual.
|
||||
</p>
|
||||
|
||||
<p><h4><a name="usecase18" href="#usecase18">Use case 18</a></h4>
|
||||
<h4>Class:</h4>
|
||||
Subexpressions that will be evaluated more then once where the only
|
||||
change is in context it doesn't depend on
|
||||
<h4>Example:</h4>
|
||||
foo[@bar = <u>sum($var/@bar)</u>]
|
||||
<h4>What we do today:</h4>
|
||||
Reevaluate the subexpression every time we need it and every time
|
||||
get the same result.
|
||||
<h4>What we could do:</h4>
|
||||
We should save the result from the first evaluation and just bring
|
||||
it back the following time we need it. This can be done by
|
||||
inserting an extra expression between the subexpression and its
|
||||
parent, this expression would then first go look in a cache
|
||||
available through the <code>nsIEvalContext</code>, if the value
|
||||
isn't available there the original expression is evaluated and its
|
||||
result is saved in the cache. The cache can be keyed on an integer
|
||||
which is stored in the inserted 'cache-expression'.<br>
|
||||
The cache itself could be created by another expression that is
|
||||
inserted at the top of the expression. This way that expression
|
||||
works as a boundry-point for the cache and can in theory be
|
||||
inserted anywhere in an expression if needed.
|
||||
</p>
|
||||
|
||||
<h2>Stage 5</h2>
|
||||
|
||||
<h3>Summary</h3>
|
||||
<p>
|
||||
Detect when we can concatenate nodesets instead of merge them in
|
||||
PathExpr.
|
||||
</p>
|
||||
|
||||
<h3>Details</h3>
|
||||
<p>
|
||||
Why can we for expressions like "foo/bar/baz" concatenate the resulting
|
||||
nodesets without having to check nodeorder? Because at every step two
|
||||
statements are true:
|
||||
<ol>
|
||||
<li>We iterate a nodeset where no node is an ancestor of another</li>
|
||||
<li>The LocationStep only returns nodes that are members of the subtree
|
||||
below the context-node</li>
|
||||
</ol>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
For example; While evaluating the second step in "foo/bar/baz" we
|
||||
iterate a nodelist containing all "foo" children of the original
|
||||
contextnode, i.e. none can be an ancestor of another. And the
|
||||
LocationStep "bar" only returns children of the contextnode.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
So, it would be nice if we can detect when this occurs as often as
|
||||
possible. For example the expression "id(foo)/bar/baz" fulfils those
|
||||
requirements if the nodeset returned from contains doesn't contain any
|
||||
ancestors of other nodes in the nodeset, which probably often is the
|
||||
case in real-world stylesheets.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
We should perform this check on every step to be able to take advantage
|
||||
of it as often as possible. For example the in expression
|
||||
"id(@boss)/ancestor::team/members" we can't use this optimisation at the
|
||||
second step since the ancestor axis returns nodes that are not members
|
||||
of the contextnodes subtree. However we will probably be able to use the
|
||||
optimisation at the third step since if iterated nodeset contains only
|
||||
one node (and thus can't contain ancestors of it's members).
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
@ -1,172 +0,0 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>TransforMiiX(tm)</TITLE>
|
||||
<META name="author" content="Keith Visco">
|
||||
</HEAD>
|
||||
<BODY Text="#000000" BGColor="#FFFFFF">
|
||||
<!-- OUTER TABLE -->
|
||||
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="640">
|
||||
<TR>
|
||||
<TD WIDTH="80"></TD>
|
||||
<TD WIDTH="80">
|
||||
<B><I><FONT SIZE="+2" COLOR="BLUE">MITRE</FONT></I></B>
|
||||
</TD>
|
||||
<TD WIDTH="480" ALIGN="RIGHT">
|
||||
<B><FONT SIZE="+2">Transfor<FONT Color="blue">Mii</FONT>X</FONT></B>
|
||||
<SUP>TM</SUP>
|
||||
</TD>
|
||||
</TR>
|
||||
<TD WIDTH="80"><BR></TD>
|
||||
<TD WIDTH="560" COLSPAN="2">
|
||||
<!-- Contents -->
|
||||
|
||||
<HR SIZE="1" />
|
||||
<BR/>
|
||||
<P>
|
||||
<B>Transfor<FONT Color="blue">Mii</FONT>X</B> is an XSLT processor which is
|
||||
not yet complete, but supports a good portion of the
|
||||
<A HREF="http://www.w3.org/TR/1999/REC-xslt-19991116">XSLT 1.0 recommendation</A>.
|
||||
|
||||
<P>
|
||||
<B>Transfor<FONT Color="blue">Mii</FONT>X</B> was designed to be a "standalone"
|
||||
XSLT processor. This means you can call the processor from the command line,
|
||||
or via the XSLProcessor API. The only thing TransforMiiX requires is an XML parser,
|
||||
and the currently supported parser is
|
||||
<A href="http://www.jclark.com/xml/expat.html">Expat</A> written by James Clark.
|
||||
</P>
|
||||
<P>
|
||||
There is currently an effort undergoing to integrate
|
||||
TransforMiiX with Mozilla. This effort
|
||||
is not yet complete and therefor the XSLT processor cannot yet be used
|
||||
within the Mozilla browser. Integration is nearing completion, however.
|
||||
</P>
|
||||
<P>
|
||||
<HR SIZE="1">
|
||||
<P>
|
||||
<B>Running <B>Transfor<FONT Color="blue">Mii</FONT>X</B> from the command line</B>
|
||||
<P />
|
||||
The command line syntax is pretty straight forward:
|
||||
<P>
|
||||
<B>example:</B> <I>transfrmx -i my.xml -s my.xsl -o my.out</I>
|
||||
</P>
|
||||
This will process the XML source file called "my.xml" using the "my.xsl" XSLT stylesheet,
|
||||
and the result will be placed in "my.out".
|
||||
|
||||
The "-s" flag is not required if the XSLT stylesheet is specified inside the XML source
|
||||
document using the "xml-stylesheet" PI (processing instruction).
|
||||
<P>
|
||||
The stylesheet PI, should appear below the XML declaration
|
||||
("<FONT SIZE="-1"><?xml version="1.0"?></FONT>").
|
||||
<P>
|
||||
<B>example:</B>
|
||||
<TABLE BGColor="" BORDER="1">
|
||||
<TR>
|
||||
<TD>
|
||||
<PRE>
|
||||
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="my.xsl" type="text/xsl"?>
|
||||
<document>
|
||||
...
|
||||
</document>
|
||||
</PRE>
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<P>
|
||||
The command line program is in "source/main/transformiix.cpp" and is simply
|
||||
a wrapper for "source/xsl/XSLProcessor.cpp" which is the TransforMiiX API.
|
||||
</P>
|
||||
<P>
|
||||
Feel free to run the examples in the "source/examples" directory, they are a
|
||||
good example of what has been implemented so far in TransforMiiX.
|
||||
<P>
|
||||
|
||||
<HR SIZE="1">
|
||||
<P>
|
||||
<B>What is the current status of Transfor<FONT Color="blue">Mii</FONT>X</B>?
|
||||
<P />
|
||||
You can check the current status by looking three main files:
|
||||
<UL>
|
||||
<LI><A HREF="changes.txt">changes.txt</A> - lists the changes from different builds
|
||||
<LI><A HREF="remaining.txt">remaining.txt</A> - lists what needs to be implemented.
|
||||
<LI><A HREF="known-issues.html">known-issues.html</A> - lists known bugs or issues.
|
||||
<BR />
|
||||
-- this is a little out of date...sorry.
|
||||
</UL>
|
||||
<P>
|
||||
<HR SIZE="1">
|
||||
<P>
|
||||
<B>What can I do to help finish the implementation of
|
||||
Transfor<FONT Color="blue">Mii</FONT>X</B>?
|
||||
<P />
|
||||
There are a number of things that can be done:
|
||||
<P>
|
||||
<B>Development</B>
|
||||
<OL>
|
||||
<LI>Check out the source code, build it.
|
||||
<LI>Use it.
|
||||
<LI>Familiarize yourself with the code.
|
||||
<LI>Look at the the "to-do" or "known issues" list and choose something
|
||||
that you would like to work on.
|
||||
<LI> If it's a large task, notify us that you are working on a task or issue, or
|
||||
would like to contribute to the existing effort of a specific task.
|
||||
<BR>
|
||||
If it's a simple change you may contact us first to make sure
|
||||
you are not duplicating effort, or feel free to just make the changes.
|
||||
<LI>If you have CVS commit status, commit your code,
|
||||
otherwise submit your code to be integrated to us.
|
||||
<BR>
|
||||
<B>
|
||||
<FONT SIZE="-1">
|
||||
Please do a "cvs update" to make sure you have the latest changes, and that
|
||||
your changes work with any code changes that might have occured during
|
||||
your development.
|
||||
</FONT>
|
||||
</B>
|
||||
</OL>
|
||||
|
||||
<B>Bug Reporting</B>
|
||||
<OL>
|
||||
<LI>Check out the source code, build it.
|
||||
<LI>Use it.
|
||||
<LI>Submit any bugs to the
|
||||
<A HREF="news://news.mozilla.org/netscape.public.mozilla.layout.xslt">
|
||||
mailing list [netscape.public.mozilla.layout.xslt]</A>
|
||||
or directly to us.
|
||||
</OL>
|
||||
|
||||
<B>Documentation</B>
|
||||
<OL>
|
||||
<LI>Check out the source code, build it.
|
||||
<LI>Use it.
|
||||
<LI>Find something that's not documented - pretty easy to do at this point.
|
||||
<LI>Document #3.
|
||||
<LI>If you have commit status, commit your documentation, otherwise
|
||||
submit your documentation directly to us.
|
||||
</OL>
|
||||
<P>
|
||||
|
||||
<B>Miscellaneous (but important)</B> <BR>
|
||||
<FONT SIZE="-1"> -- I just wouldn't be myself if I didn't add these! -- Keith :-) </FONT>
|
||||
<OL>
|
||||
<LI>Get me a date with Claudia Schiffer or Kelly Hu.
|
||||
<LI>Get me some coffee!
|
||||
</OL>
|
||||
<P>
|
||||
<!-- End Contents -->
|
||||
|
||||
<!-- Footer -->
|
||||
<HR SIZE="1">
|
||||
<FONT SIZE="-1">
|
||||
The MITRE Corporation, Keith Visco (C) Copyright 1999, All rights reserved<BR>
|
||||
Email: <A HREF="mailto:kvisco@ziplink.net">Keith Visco</A>,
|
||||
<A HREF="mailto:tomk@mitre.org">Tom Kneeland</A>
|
||||
</FONT>
|
||||
<!-- End Footer -->
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<!-- End Outer Table -->
|
||||
</HTML>
|
@ -1,45 +0,0 @@
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is TransforMiiX XSLT processor code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Axel Hecht.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2002
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Axel Hecht <axel@pike.org>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
@ -1,77 +0,0 @@
|
||||
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Axel Hecht.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Axel Hecht <axel@pike.org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const enablePrivilege = netscape.security.PrivilegeManager.enablePrivilege;
|
||||
const IOSERVICE_CTRID = "@mozilla.org/network/io-service;1";
|
||||
const nsIIOService = Components.interfaces.nsIIOService;
|
||||
const SIS_CTRID = "@mozilla.org/scriptableinputstream;1";
|
||||
const nsISIS = Components.interfaces.nsIScriptableInputStream;
|
||||
const nsIFilePicker = Components.interfaces.nsIFilePicker;
|
||||
const STDURL_CTRID = "@mozilla.org/network/standard-url;1";
|
||||
const nsIURI = Components.interfaces.nsIURI;
|
||||
|
||||
var gStop = false;
|
||||
|
||||
function loadFile(aUriSpec)
|
||||
{
|
||||
enablePrivilege('UniversalXPConnect');
|
||||
var serv = Components.classes[IOSERVICE_CTRID].
|
||||
getService(nsIIOService);
|
||||
if (!serv) {
|
||||
throw Components.results.ERR_FAILURE;
|
||||
}
|
||||
var chan = serv.newChannel(aUriSpec, null, null);
|
||||
var instream =
|
||||
Components.classes[SIS_CTRID].createInstance(nsISIS);
|
||||
instream.init(chan.open());
|
||||
|
||||
return instream.read(instream.available());
|
||||
}
|
||||
|
||||
function dump20(aVal)
|
||||
{
|
||||
const pads = ' ';
|
||||
if (typeof(aVal)=='string')
|
||||
out = aVal;
|
||||
else if (typeof(aVal)=='number')
|
||||
out = Number(aVal).toFixed(2);
|
||||
else
|
||||
out = new String(aVal);
|
||||
dump(pads.substring(0, 20 - out.length));
|
||||
dump(out);
|
||||
}
|
@ -1,79 +0,0 @@
|
||||
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Axel Hecht.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Axel Hecht <axel@pike.org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
var gParser = new DOMParser;
|
||||
var gProc = new XSLTProcessor;
|
||||
var gTimeout;
|
||||
|
||||
function Test(aTitle, aSourceURL, aStyleURL, aNumber, aObserver)
|
||||
{
|
||||
this.mTitle = aTitle;
|
||||
this.mObserver = aObserver;
|
||||
this.mTotal = aNumber;
|
||||
this.mDone = 0;
|
||||
var xmlcontent = loadFile(aSourceURL);
|
||||
var xslcontent = loadFile(aStyleURL);
|
||||
this.mSource = gParser.parseFromString(xmlcontent, 'application/xml');
|
||||
this.mStyle = gParser.parseFromString(xslcontent, 'application/xml');
|
||||
}
|
||||
|
||||
function runTest(aTitle, aSourceURL, aStyleURL, aNumber, aObserver)
|
||||
{
|
||||
test = new Test(aTitle, aSourceURL, aStyleURL, aNumber,
|
||||
aObserver);
|
||||
gTimeout = setTimeout(onNextTransform, 100, test, 0);
|
||||
}
|
||||
|
||||
function onNextTransform(aTest, aNumber)
|
||||
{
|
||||
res = document.implementation.createDocument('', '', null);
|
||||
var startTime = Date.now();
|
||||
gProc.transformDocument(aTest.mSource, aTest.mStyle, res, null);
|
||||
var endTime = Date.now();
|
||||
aNumber++;
|
||||
var progress = aNumber / aTest.mTotal * 100;
|
||||
if (aTest.mObserver) {
|
||||
aTest.mObserver.progress(aTest.mTitle, endTime - startTime,
|
||||
progress);
|
||||
}
|
||||
if (aNumber < aTest.mTotal) {
|
||||
gTimeout = setTimeout(onNextTransform, 100, aTest, aNumber);
|
||||
} else if (aTest.mObserver) {
|
||||
aTest.mObserver.done(aTest.mTitle);
|
||||
}
|
||||
}
|
@ -1,208 +0,0 @@
|
||||
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Axel Hecht.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Axel Hecht <axel@pike.org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
var view =
|
||||
{
|
||||
configUrl: null,
|
||||
testArray: null,
|
||||
mCurrent: null,
|
||||
|
||||
browseForConfig: function()
|
||||
{
|
||||
enablePrivilege('UniversalXPConnect');
|
||||
var fp = Components.classes["@mozilla.org/filepicker;1"].
|
||||
createInstance(nsIFilePicker);
|
||||
fp.init(window,'XSLTMark Description File',nsIFilePicker.modeOpen);
|
||||
fp.appendFilter('*.conf', '*.conf');
|
||||
fp.appendFilters(nsIFilePicker.filterAll);
|
||||
var res = fp.show();
|
||||
|
||||
if (res == nsIFilePicker.returnOK) {
|
||||
this.configUrl = Components.classes[STDURL_CTRID].createInstance(nsIURI);
|
||||
this.configUrl.spec = fp.fileURL.spec;
|
||||
document.getElementById('config').setAttribute('value', this.configUrl.spec);
|
||||
}
|
||||
this.parseConfig();
|
||||
return true;
|
||||
},
|
||||
|
||||
parseConfig: function()
|
||||
{
|
||||
this.testArray = new Array();
|
||||
var test;
|
||||
if (!this.configUrl) {
|
||||
return;
|
||||
}
|
||||
|
||||
var content = loadFile(this.configUrl.spec);
|
||||
|
||||
var lines = content.split("\n");
|
||||
var line, res;
|
||||
var head = /^\[(.+)\]$/;
|
||||
var instruct = /^(.+)=(.+)$/;
|
||||
while (lines.length) {
|
||||
line = lines.shift();
|
||||
if (head.test(line)) {
|
||||
test = new Object;
|
||||
res = head.exec(line);
|
||||
test['title'] = res[1];
|
||||
this.testArray.push(test);
|
||||
}
|
||||
else if (line == '') {
|
||||
test = undefined;
|
||||
}
|
||||
else {
|
||||
res = instruct.exec(line);
|
||||
test[res[1]] = res[2];
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onLoad: function()
|
||||
{
|
||||
this.mCurrentStatus = document.getElementById('currentStatus');
|
||||
this.mCurrentProgress = document.getElementById('currentProgress');
|
||||
this.mTotalProgress = document.getElementById('totalProgress');
|
||||
this.mOutput = document.getElementById('transformOutput');
|
||||
this.mDetailOutput =
|
||||
document.getElementById('transformDetailedOutput');
|
||||
this.mDetail = true;
|
||||
},
|
||||
|
||||
progress: function(aTitle, aTime, aProgress)
|
||||
{
|
||||
// dump20(aTitle);
|
||||
// dump20(aTime);
|
||||
// dump20(aProgress);
|
||||
this.mCurrentProgress.value = aProgress;
|
||||
this.displayDetailTime(aTime);
|
||||
this.mTimes.push(aTime);
|
||||
// dump("\n");
|
||||
},
|
||||
|
||||
done: function(aTitle)
|
||||
{
|
||||
// dump(aTitle + " is finished.\n");
|
||||
this.mCurrent++;
|
||||
this.mCurrentProgress.value = 0;
|
||||
this.displayTotalTime();
|
||||
if (this.mCurrent >= this.testArray.length) {
|
||||
this.mTotalProgress.value = 0;
|
||||
this.mCurrentStatus.value = "done";
|
||||
return;
|
||||
}
|
||||
this.mTotalProgress.value = this.mCurrent*100/this.testArray.length;
|
||||
var test = this.testArray[this.mCurrent];
|
||||
enablePrivilege('UniversalXPConnect');
|
||||
this.displayTest(test.title);
|
||||
runTest(test.title, this.configUrl.resolve(test.input),
|
||||
this.configUrl.resolve(test.stylesheet),
|
||||
test.iterations, this);
|
||||
},
|
||||
|
||||
onStop: function()
|
||||
{
|
||||
clearTimeout(gTimeout);
|
||||
this.mCurrentProgress.value = 0;
|
||||
this.mTotalProgress.value = 0;
|
||||
this.mCurrentStatus.value = "stopped";
|
||||
},
|
||||
|
||||
displayTest: function(aTitle)
|
||||
{
|
||||
this.mTimes = new Array;
|
||||
aTitle += "\t";
|
||||
this.mCurrentStatus.value = aTitle;
|
||||
this.mOutput.value += aTitle;
|
||||
if (this.mDetail) {
|
||||
this.mDetailOutput.value += aTitle;
|
||||
}
|
||||
},
|
||||
|
||||
displayDetailTime: function(aTime)
|
||||
{
|
||||
if (this.mDetail) {
|
||||
this.mDetailOutput.value += aTime + " ms\t";
|
||||
}
|
||||
},
|
||||
|
||||
displayTotalTime: function()
|
||||
{
|
||||
var sum = 0;
|
||||
for (k = 0; k < this.mTimes.length; k++) {
|
||||
sum += this.mTimes[k];
|
||||
}
|
||||
var mean = sum / this.mTimes.length;
|
||||
this.mOutput.value += Number(mean).toFixed(2) + " ms\t" + sum + " ms\t";
|
||||
var variance = 0;
|
||||
for (k = 0; k < this.mTimes.length; k++) {
|
||||
var n = this.mTimes[k] - mean;
|
||||
variance += n*n;
|
||||
}
|
||||
variance = Math.sqrt(variance/this.mTimes.length);
|
||||
this.mOutput.value += Number(variance).toFixed(2)+"\n";
|
||||
if (this.mDetail) {
|
||||
this.mDetailOutput.value += "\n";
|
||||
}
|
||||
},
|
||||
|
||||
runBenchmark: function()
|
||||
{
|
||||
enablePrivilege('UniversalXPConnect');
|
||||
if (!this.testArray) {
|
||||
if (!this.configUrl) {
|
||||
this.configUrl = Components.classes[STDURL_CTRID].createInstance(nsIURI);
|
||||
this.configUrl.spec = document.getElementById('config').value;
|
||||
}
|
||||
this.parseConfig();
|
||||
}
|
||||
|
||||
this.mCurrent = 0;
|
||||
var test = this.testArray[this.mCurrent];
|
||||
this.mOutput.value = '';
|
||||
if (this.mDetail) {
|
||||
this.mDetailOutput.value = '';
|
||||
}
|
||||
this.displayTest(test.title);
|
||||
runTest(test.title, this.configUrl.resolve(test.input),
|
||||
this.configUrl.resolve(test.stylesheet),
|
||||
test.iterations, this);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1,41 +0,0 @@
|
||||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Axel Hecht.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Axel Hecht <axel@pike.org> (Original Author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
textbox.out {
|
||||
white-space: pre;
|
||||
}
|
@ -1,85 +0,0 @@
|
||||
<?xml version="1.0"?><!-- -*- Mode: xml; tab-width: 2; indent-tabs-mode: nil -*- -->
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is TransforMiiX XSLT processor code.
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Axel Hecht.
|
||||
Portions created by the Initial Developer are Copyright (C) 2002
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Axel Hecht <axel@pike.org> (Original Author)
|
||||
|
||||
Alternatively, the contents of this file may be used under the terms of
|
||||
either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
of those above. If you wish to allow use of your version of this file only
|
||||
under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
use your version of this file under the terms of the MPL, indicate your
|
||||
decision by deleting the provisions above and replace them with the notice
|
||||
and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
the provisions above, a recipient may use your version of this file under
|
||||
the terms of any one of the MPL, the GPL or the LGPL.
|
||||
|
||||
***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="XSLTMark.css" type="text/css"?>
|
||||
<window id="XSLTMarkHarness"
|
||||
title="XSLTMark"
|
||||
onload="view.onLoad()"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
orient="vertical">
|
||||
<script type="application/x-javascript" src="XSLTMark-static.js" />
|
||||
<script type="application/x-javascript" src="XSLTMark-test.js" />
|
||||
<script type="application/x-javascript" src="XSLTMark-view.js" />
|
||||
|
||||
<hbox>
|
||||
<groupbox orient="horizontal">
|
||||
<caption label="test description file" />
|
||||
<label value=""/><!-- needed, otherwise groupbox fucks up :-( -->
|
||||
<textbox id="config" persist="value" readonly="true"/>
|
||||
<button label="browse..." oncommand="view.browseForConfig();" />
|
||||
</groupbox>
|
||||
<groupbox orient="horizontal">
|
||||
<caption label="test control" />
|
||||
<button label="run..."
|
||||
oncommand="setTimeout('view.runBenchmark();', 0);" />
|
||||
<button label="stop" oncommand="view.onStop();" />
|
||||
</groupbox>
|
||||
<groupbox orient="horizontal">
|
||||
<caption label="options" />
|
||||
<label value="responsiveness: "/>
|
||||
<menulist label="sloppy">
|
||||
<menupopup>
|
||||
<menuitem label="sloppy" selected="true"/>
|
||||
<menuitem label="bad"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
</groupbox>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<textbox id="currentStatus" readonly="true" flex="1"/>
|
||||
<progressmeter id="currentProgress" mode="normal" value="0" flex="2"/>
|
||||
<progressmeter id="totalProgress" mode="normal" value="0" flex="2"/>
|
||||
</hbox>
|
||||
<hbox flex="1">
|
||||
<textbox id="transformOutput" class="out" readonly="true" multiline="true" flex="1"/>
|
||||
</hbox>
|
||||
<hbox flex="1">
|
||||
<textbox id="transformDetailedOutput" class="out" readonly="true" multiline="true" flex="1"/>
|
||||
</hbox>
|
||||
</window>
|
@ -1,136 +0,0 @@
|
||||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Axel Hecht.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Axel Hecht <axel@pike.org> (Original Author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
// ----------------------
|
||||
// DiffDOM(node1,node2)
|
||||
// ----------------------
|
||||
|
||||
var isHTML = false;
|
||||
|
||||
function DiffDOM(node1, node2, aIsHTML)
|
||||
{
|
||||
isHTML = aIsHTML;
|
||||
return DiffNodeAndChildren(node1, node2);
|
||||
}
|
||||
|
||||
|
||||
// namespace attributes in the second node are ignored
|
||||
const nsreg = /^xmlns[|:\w]/;
|
||||
|
||||
// This function does the work of DiffDOM by recursively calling
|
||||
// itself to explore the tree
|
||||
function DiffNodeAndChildren(node1, node2)
|
||||
{
|
||||
if (!node1 && !node2)
|
||||
return true;
|
||||
if (!node1 || !node2)
|
||||
return ErrorUp("One of the nodes is null", node1, node2);
|
||||
if (node1.type!=node2.type)
|
||||
return ErrorUp("Different node types", node1, node2);
|
||||
|
||||
var attributes = node2.attributes;
|
||||
if (attributes && attributes.length) {
|
||||
var item, name, ns, value, otherValue;
|
||||
for (var index = 0; index < attributes.length; index++) {
|
||||
item = attributes.item(index);
|
||||
ns = item.namespaceURI;
|
||||
if (ns) {
|
||||
name = item.localName;
|
||||
otherValue = node2.getAttributeNS(ns, name);
|
||||
}
|
||||
else {
|
||||
name = item.nodeName;
|
||||
otherValue = node2.getAttribute(name);
|
||||
}
|
||||
value = item.nodeValue;
|
||||
if (!nsreg.test(name) && otherValue!=value) {
|
||||
return ErrorUp("Different values for attribute", node1, node2);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (node1.attributes && node1.attributes.length) {
|
||||
return ErrorUp("Different number of attributes", node1, node2);
|
||||
}
|
||||
|
||||
if (isHTML) {
|
||||
if (node1.nodeName.toLowerCase()!=node2.nodeName.toLowerCase())
|
||||
return ErrorUp("Different node names", node1, node2);
|
||||
}
|
||||
else {
|
||||
if (node1.nodeName!=node2.nodeName)
|
||||
return ErrorUp("Different node names", node1, node2);
|
||||
}
|
||||
if (node1.nodeValue!=node2.nodeValue)
|
||||
return ErrorUp("Different node values", node1, node2);
|
||||
if (!isHTML)
|
||||
if (node1.namespaceURI!=node2.namespaceURI)
|
||||
return ErrorUp("Different namespace", node1, node2);
|
||||
if (node1.hasChildNodes() != node2.hasChildNodes())
|
||||
return ErrorUp("Different children", node1, node2);
|
||||
if (node1.childNodes) {
|
||||
if (node1.childNodes.length != node2.childNodes.length)
|
||||
return ErrorUp("Different number of children", node1, node2);
|
||||
for (var child = 0; child < node1.childNodes.length; child++) {
|
||||
if (!DiffNodeAndChildren(node1.childNodes[child],
|
||||
node2.childNodes[child])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function ErrorUp(errMsg, node1, node2)
|
||||
{
|
||||
dump("Error: "+errMsg+"\n");
|
||||
if (node1) {
|
||||
dump("Node 1: "+node1+", ");
|
||||
if (node1.nodeType == Node.TEXT_NODE)
|
||||
dump("nodeValue: "+node1.nodeValue+"\n");
|
||||
else
|
||||
dump("nodeName: "+node1.namespaceURI+":"+node1.nodeName+"\n");
|
||||
}
|
||||
if (node2) {
|
||||
dump("Node 2: "+node2+", ");
|
||||
if (node2.nodeType == Node.TEXT_NODE)
|
||||
dump("nodeValue: "+node2.nodeValue+"\n");
|
||||
else
|
||||
dump("nodeName: "+node2.namespaceURI+":"+node2.nodeName+"\n");
|
||||
}
|
||||
return false;
|
||||
}
|
@ -1,85 +0,0 @@
|
||||
// ----------------------
|
||||
// DumpDOM(node)
|
||||
//
|
||||
// Call this function to dump the contents of the DOM starting at the specified node.
|
||||
// Use node = document.documentElement to dump every element of the current document.
|
||||
// Use node = top.window.document.documentElement to dump every element.
|
||||
//
|
||||
// 8-13-99 Updated to dump almost all attributes of every node. There are still some attributes
|
||||
// that are purposely skipped to make it more readable.
|
||||
// ----------------------
|
||||
function DumpDOM(node)
|
||||
{
|
||||
dump("--------------------- DumpDOM ---------------------\n");
|
||||
|
||||
DumpNodeAndChildren(node, "");
|
||||
|
||||
dump("------------------- End DumpDOM -------------------\n");
|
||||
}
|
||||
|
||||
|
||||
// This function does the work of DumpDOM by recursively calling itself to explore the tree
|
||||
function DumpNodeAndChildren(node, prefix)
|
||||
{
|
||||
dump(prefix + "<" + node.nodeName);
|
||||
|
||||
var attributes = node.attributes;
|
||||
|
||||
if ( attributes && attributes.length )
|
||||
{
|
||||
var item, name, value;
|
||||
|
||||
for ( var index = 0; index < attributes.length; index++ )
|
||||
{
|
||||
item = attributes.item(index);
|
||||
name = item.nodeName;
|
||||
value = item.nodeValue;
|
||||
|
||||
if ( (name == 'lazycontent' && value == 'true') ||
|
||||
(name == 'xulcontentsgenerated' && value == 'true') ||
|
||||
(name == 'id') ||
|
||||
(name == 'instanceOf') )
|
||||
{
|
||||
// ignore these
|
||||
}
|
||||
else
|
||||
{
|
||||
dump(" " + name + "=\"" + value + "\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( node.nodeType == 1 )
|
||||
{
|
||||
// id
|
||||
var text = node.getAttribute('id');
|
||||
if ( text && text[0] != '$' )
|
||||
dump(" id=\"" + text + "\"");
|
||||
}
|
||||
|
||||
if ( node.nodeType == Node.TEXT_NODE )
|
||||
dump(" = \"" + node.data + "\"");
|
||||
|
||||
dump(">\n");
|
||||
|
||||
// dump IFRAME && FRAME DOM
|
||||
if ( node.nodeName == "IFRAME" || node.nodeName == "FRAME" )
|
||||
{
|
||||
if ( node.name )
|
||||
{
|
||||
var wind = top.frames[node.name];
|
||||
if ( wind && wind.document && wind.document.documentElement )
|
||||
{
|
||||
dump(prefix + "----------- " + node.nodeName + " -----------\n");
|
||||
DumpNodeAndChildren(wind.document.documentElement, prefix + " ");
|
||||
dump(prefix + "--------- End " + node.nodeName + " ---------\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
// children of nodes (other than frames)
|
||||
else if ( node.childNodes )
|
||||
{
|
||||
for ( var child = 0; child < node.childNodes.length; child++ )
|
||||
DumpNodeAndChildren(node.childNodes[child], prefix + " ");
|
||||
}
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is TransforMiiX XSLT processor code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Axel Hecht.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2002
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Axel Hecht <axel@pike.org>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
@ -1,22 +0,0 @@
|
||||
The buster is a XUL interface to the conformance tests shipped as part of
|
||||
Xalan. For information about Xalan, please see http://xml.apache.org/.
|
||||
For your convenience we provide a packed distribution of all needed files
|
||||
in http://www.axel.pike.org/mozilla/xalan.tar.gz. Please see the included
|
||||
LICENSE.txt or http://xml.apache.org/dist/LICENSE.txt for terms of
|
||||
distributing those files.
|
||||
|
||||
To use the buster, open buster.xul with an XSLT enabled Mozilla.
|
||||
Open the rdf index file shipped with the test package into the
|
||||
"Xalan index", and the available tests will show up as a tree.
|
||||
Once you have selected the tests you're interested in, press the button
|
||||
"run checked tests", and all the tests will be run.
|
||||
You can save the results into an rdf, and load it for comparison and
|
||||
regression hunting.
|
||||
|
||||
DiffDOM tries to find out, which tests failed, and will DumpDOM both the
|
||||
result and the reference solution. Not all reference solutions load
|
||||
properly, those need manual love.
|
||||
|
||||
Good luck and fun
|
||||
|
||||
Axel Hecht <axel@pike.org>
|
@ -1,115 +0,0 @@
|
||||
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Axel Hecht.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Axel Hecht <axel@pike.org>
|
||||
* Peter Van der Beken <peterv@propagandism.org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const kFileOutStreamCID = "@mozilla.org/network/file-output-stream;1";
|
||||
const nsIFileOutputStream = Components.interfaces.nsIFileOutputStream;
|
||||
|
||||
var cmdFileController =
|
||||
{
|
||||
supportsCommand: function(aCommand)
|
||||
{
|
||||
switch(aCommand) {
|
||||
case 'cmd_fl_save':
|
||||
case 'cmd_fl_import':
|
||||
return true;
|
||||
default:
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isCommandEnabled: function(aCommand)
|
||||
{
|
||||
return this.supportsCommand(aCommand);
|
||||
},
|
||||
doCommand: function(aCommand)
|
||||
{
|
||||
switch(aCommand) {
|
||||
case 'cmd_fl_save':
|
||||
var sink = new Object;
|
||||
sink.write = function(aContent, aCount)
|
||||
{
|
||||
// replace NC:succ with NC:orig_succ,
|
||||
// so the rdf stuff differs
|
||||
var content = aContent.replace(/NC:succ/g,"NC:orig_succ");
|
||||
content = content.replace(/NC:failCount/g,"NC:orig_failCount");
|
||||
this.mSink.write(content, content.length);
|
||||
return aCount;
|
||||
};
|
||||
var fp = doCreateRDFFP('Xalan results',
|
||||
nsIFilePicker.modeSave);
|
||||
var res = fp.show();
|
||||
|
||||
if (res == nsIFilePicker.returnOK ||
|
||||
res == nsIFilePicker.returnReplace) {
|
||||
var serial = doCreate(kRDFXMLSerializerID,
|
||||
nsIRDFXMLSerializer);
|
||||
serial.init(view.mResultDS);
|
||||
serial.QueryInterface(nsIRDFXMLSource);
|
||||
var fl = fp.file;
|
||||
var fstream = doCreate(kFileOutStreamCID,
|
||||
nsIFileOutputStream);
|
||||
fstream.init(fl, 26, 420, 0);
|
||||
sink.mSink = fstream;
|
||||
serial.Serialize(sink);
|
||||
}
|
||||
break;
|
||||
case 'cmd_fl_import':
|
||||
var fp = doCreateRDFFP('Previous Xalan results',
|
||||
nsIFilePicker.modeLoad);
|
||||
var res = fp.show();
|
||||
|
||||
if (res == nsIFilePicker.returnOK) {
|
||||
var fl = fp.file;
|
||||
if (view.mPreviousResultDS) {
|
||||
view.database.RemoveDataSource(view.mPreviousResultDS);
|
||||
view.mPreviousResultDS = null;
|
||||
}
|
||||
view.mPreviousResultDS = kRDFSvc.GetDataSource(fp.fileURL.spec);
|
||||
view.database.AddDataSource(view.mPreviousResultDS);
|
||||
}
|
||||
|
||||
document.getElementById('obs_orig_success')
|
||||
.setAttribute('hidden','false');
|
||||
break;
|
||||
default:
|
||||
alert('Unknown Command'+aCommand);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
registerController(cmdFileController);
|
@ -1,71 +0,0 @@
|
||||
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Axel Hecht.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Axel Hecht <axel@pike.org>
|
||||
* Peter Van der Beken <peterv@propagandism.org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
var xalan_field;
|
||||
|
||||
function onLoad()
|
||||
{
|
||||
view.tree = document.getElementById('out');
|
||||
view.boxObject = view.tree.boxObject.QueryInterface(Components.interfaces.nsITreeBoxObject);
|
||||
{
|
||||
view.mIframe = document.getElementById('hiddenHtml');
|
||||
view.mIframe.webNavigation.allowPlugins = false;
|
||||
view.mIframe.webNavigation.allowJavascript = false;
|
||||
view.mIframe.webNavigation.allowMetaRedirects = false;
|
||||
view.mIframe.webNavigation.allowImages = false;
|
||||
}
|
||||
view.database = view.tree.database;
|
||||
view.builder = view.tree.builder.QueryInterface(nsIXULTemplateBuilder);
|
||||
view.builder.QueryInterface(nsIXULTreeBuilder);
|
||||
runItem.prototype.kDatabase = view.database;
|
||||
xalan_field = document.getElementById("xalan_rdf");
|
||||
var persistedUrl = xalan_field.getAttribute('url');
|
||||
if (persistedUrl) {
|
||||
view.xalan_url = persistedUrl;
|
||||
xalan_field.value = persistedUrl;
|
||||
}
|
||||
view.setDataSource();
|
||||
return true;
|
||||
}
|
||||
|
||||
function onUnload()
|
||||
{
|
||||
if (xalan_field)
|
||||
xalan_field.setAttribute('url', xalan_field.value);
|
||||
}
|
@ -1,121 +0,0 @@
|
||||
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Axel Hecht.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Axel Hecht <axel@pike.org>
|
||||
* Peter Van der Beken <peterv@propagandism.org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
// helper function to shortcut component creation
|
||||
function doCreate(aContract, aInterface)
|
||||
{
|
||||
return Components.classes[aContract].createInstance(aInterface);
|
||||
}
|
||||
|
||||
// for the items, loading a text file
|
||||
const IOSERVICE_CTRID = "@mozilla.org/network/io-service;1";
|
||||
const nsIIOService = Components.interfaces.nsIIOService;
|
||||
const SIS_CTRID = "@mozilla.org/scriptableinputstream;1"
|
||||
const nsISIS = Components.interfaces.nsIScriptableInputStream;
|
||||
|
||||
// rdf foo, onload handler
|
||||
const kRDFSvcContractID = "@mozilla.org/rdf/rdf-service;1";
|
||||
const kRDFInMemContractID =
|
||||
"@mozilla.org/rdf/datasource;1?name=in-memory-datasource";
|
||||
const kRDFContUtilsID = "@mozilla.org/rdf/container-utils;1";
|
||||
const kRDFXMLSerializerID = "@mozilla.org/rdf/xml-serializer;1";
|
||||
const kIOSvcContractID = "@mozilla.org/network/io-service;1";
|
||||
const kStandardURL = Components.classes["@mozilla.org/network/standard-url;1"];
|
||||
const nsIURL = Components.interfaces.nsIURL;
|
||||
const nsIStandardURL = Components.interfaces.nsIStandardURL;
|
||||
const nsIFilePicker = Components.interfaces.nsIFilePicker;
|
||||
const nsIXULTreeBuilder = Components.interfaces.nsIXULTreeBuilder;
|
||||
const nsIXULTemplateBuilder = Components.interfaces.nsIXULTemplateBuilder;
|
||||
const kIOSvc = Components.classes[kIOSvcContractID]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
const nsIRDFService = Components.interfaces.nsIRDFService;
|
||||
const nsIRDFDataSource = Components.interfaces.nsIRDFDataSource;
|
||||
const nsIRDFRemoteDataSource = Components.interfaces.nsIRDFRemoteDataSource;
|
||||
const nsIRDFPurgeableDataSource =
|
||||
Components.interfaces.nsIRDFPurgeableDataSource;
|
||||
const nsIRDFResource = Components.interfaces.nsIRDFResource;
|
||||
const nsIRDFLiteral = Components.interfaces.nsIRDFLiteral;
|
||||
const nsIRDFInt = Components.interfaces.nsIRDFInt;
|
||||
const nsIRDFContainerUtils = Components.interfaces.nsIRDFContainerUtils;
|
||||
const nsIRDFXMLSerializer = Components.interfaces.nsIRDFXMLSerializer;
|
||||
const nsIRDFXMLSource = Components.interfaces.nsIRDFXMLSource;
|
||||
const kRDFSvc =
|
||||
Components.classes[kRDFSvcContractID].getService(nsIRDFService);
|
||||
const krTypeCat = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#category");
|
||||
const krTypeFailCount = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#failCount");
|
||||
const krTypeName = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#name");
|
||||
const krTypeSucc = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#succ");
|
||||
const krTypeOrigSucc = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#orig_succ");
|
||||
const krTypeOrigFailCount = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#orig_failCount");
|
||||
const krTypeOrigSuccCount = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#orig_succCount");
|
||||
const krTypePath = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#path");
|
||||
const krTypeParent = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#parent");
|
||||
const krTypePurp = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#purp");
|
||||
const krTypeSuccCount = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#succCount");
|
||||
const kGood = kRDFSvc.GetLiteral("yes");
|
||||
const kBad = kRDFSvc.GetLiteral("no");
|
||||
const kMixed = kRDFSvc.GetLiteral("+-");
|
||||
const kContUtils = doCreate(kRDFContUtilsID, nsIRDFContainerUtils);
|
||||
|
||||
function doCreateRDFFP(aTitle, aMode)
|
||||
{
|
||||
var fp = doCreate("@mozilla.org/filepicker;1", nsIFilePicker);
|
||||
fp.init(window, aTitle, aMode);
|
||||
fp.appendFilter('*.rdf', '*.rdf');
|
||||
fp.appendFilters(nsIFilePicker.filterAll);
|
||||
return fp;
|
||||
}
|
||||
|
||||
function goDoCommand(aCommand)
|
||||
{
|
||||
try {
|
||||
var controller =
|
||||
top.document.commandDispatcher.getControllerForCommand(aCommand);
|
||||
if (controller && controller.isCommandEnabled(aCommand))
|
||||
controller.doCommand(aCommand);
|
||||
}
|
||||
catch(e) {
|
||||
dump("An error "+e+" occurred executing the "+aCommand+" command\n");
|
||||
}
|
||||
}
|
||||
|
||||
function registerController(aController)
|
||||
{
|
||||
top.controllers.appendController(aController);
|
||||
}
|
@ -1,390 +0,0 @@
|
||||
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Axel Hecht.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Axel Hecht <axel@pike.org>
|
||||
* Peter Van der Beken <peterv@propagandism.org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
var parser = new DOMParser();
|
||||
var methodExpr = (new XPathEvaluator).createExpression("xsl:output/@method",
|
||||
{
|
||||
lookupNamespaceURI: function(aPrefix)
|
||||
{
|
||||
if (aPrefix == "xsl")
|
||||
return "http://www.w3.org/1999/XSL/Transform";
|
||||
return "";
|
||||
}
|
||||
});
|
||||
|
||||
const nsIWebProgListener = Components.interfaces.nsIWebProgressListener;
|
||||
|
||||
var runQueue =
|
||||
{
|
||||
mArray : new Array(),
|
||||
push : function(aRunItem)
|
||||
{
|
||||
this.mArray.push(aRunItem);
|
||||
},
|
||||
observe : function(aSubject, aTopic, aData)
|
||||
{
|
||||
var item = this.mArray.shift();
|
||||
if (item) {
|
||||
item.run(this);
|
||||
}
|
||||
},
|
||||
run : function()
|
||||
{
|
||||
this.observe(null,'','');
|
||||
}
|
||||
}
|
||||
|
||||
var itemCache =
|
||||
{
|
||||
mArray : new Array(),
|
||||
getItem : function(aResource)
|
||||
{
|
||||
// Directory selected
|
||||
if (kContUtils.IsSeq(runItem.prototype.kDatabase, aResource)) {
|
||||
var aSeq = kContUtils.MakeSeq(runItem.prototype.kDatabase, aResource);
|
||||
dump("sequence: "+aSeq+" with "+aSeq.GetCount()+" elements\n");
|
||||
var child, children = aSeq.GetElements();
|
||||
var m = 0, first;
|
||||
while (children.hasMoreElements()) {
|
||||
m += 1;
|
||||
child = children.getNext();
|
||||
child.QueryInterface(nsIRDFResource);
|
||||
if (!first)
|
||||
first = itemCache.getItem(child);
|
||||
else
|
||||
itemCache.getItem(child);
|
||||
}
|
||||
return first;
|
||||
}
|
||||
if (aResource.Value in this.mArray) {
|
||||
return this.mArray[aResource.Value];
|
||||
}
|
||||
var retItem = new runItem(aResource);
|
||||
this.mArray[aResource.Value] = retItem;
|
||||
runQueue.push(retItem);
|
||||
return retItem;
|
||||
},
|
||||
rerunItem : function(aResource, aObserver)
|
||||
{
|
||||
var anItem = new runItem(aResource);
|
||||
this.mArray[aResource.Value] = anItem;
|
||||
anItem.run(aObserver);
|
||||
},
|
||||
observe : function(aSubject, aTopic, aData)
|
||||
{
|
||||
this.mRun += 1;
|
||||
if (aTopic == "success") {
|
||||
if (aData == "yes") {
|
||||
this.mGood += 1;
|
||||
}
|
||||
else {
|
||||
this.mFalse +=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function runItem(aResource)
|
||||
{
|
||||
this.mResource = aResource;
|
||||
// Directory selected
|
||||
if (kContUtils.IsSeq(this.kDatabase,this.mResource)) {
|
||||
var aSeq = kContUtils.MakeSeq(this.kDatabase,this.mResource);
|
||||
dump("THIS SHOULDN'T HAPPEN\n");
|
||||
var child, children = aSeq.GetElements();
|
||||
var m = 0;
|
||||
while (children.hasMoreElements()) {
|
||||
m += 1;
|
||||
child = children.getNext();
|
||||
child.QueryInterface(nsIRDFResource);
|
||||
itemCache.getItem(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
runItem.prototype =
|
||||
{
|
||||
// RDF resource associated with this test
|
||||
mResource : null,
|
||||
// XML documents for the XSLT transformation
|
||||
mSourceDoc : null,
|
||||
mStyleDoc : null,
|
||||
mResDoc : null,
|
||||
// XML or plaintext document for the reference
|
||||
mRefDoc : null,
|
||||
// bitfield signaling the loaded documents
|
||||
mLoaded : 0,
|
||||
kSource : 1,
|
||||
kStyle : 2,
|
||||
kReference : 4,
|
||||
// a observer, potential argument to run()
|
||||
mObserver : null,
|
||||
mSuccess : null,
|
||||
mMethod : 'xml',
|
||||
// XSLTProcessor, shared by the instances
|
||||
kProcessor : new XSLTProcessor(),
|
||||
kXalan : kStandardURL.createInstance(nsIURL),
|
||||
kDatabase : null,
|
||||
kObservers : new Array(),
|
||||
|
||||
run : function(aObserver)
|
||||
{
|
||||
if (aObserver && typeof(aObserver)=='function' ||
|
||||
(typeof(aObserver)=='object' &&
|
||||
typeof(aObserver.observe)=='function')) {
|
||||
this.mObserver=aObserver;
|
||||
}
|
||||
var name = this.kDatabase.GetTarget(this.mResource, krTypeName, true);
|
||||
if (name) {
|
||||
var cat = this.kDatabase.GetTarget(this.mResource, krTypeCat, true);
|
||||
var path = this.kDatabase.GetTarget(this.mResource, krTypePath, true);
|
||||
cat = cat.QueryInterface(nsIRDFLiteral);
|
||||
name = name.QueryInterface(nsIRDFLiteral);
|
||||
path = path.QueryInterface(nsIRDFLiteral);
|
||||
var xalan_fl = this.kXalan.resolve(cat.Value+"/"+path.Value);
|
||||
var xalan_ref = this.kXalan.resolve(cat.Value+"-gold/"+path.Value);
|
||||
this.mRefURL =
|
||||
this.kXalan.resolve(cat.Value + "-gold/" + path.Value + ".out");
|
||||
dump(name.Value+" links to "+xalan_fl+"\n");
|
||||
}
|
||||
// Directory selected
|
||||
if (kContUtils.IsSeq(this.kDatabase,this.mResource)) {
|
||||
return;
|
||||
var aSeq = kContUtils.MakeSeq(this.kDatabase,this.mResource);
|
||||
dump("sequence: "+aSeq+" with "+aSeq.GetCount()+" elements\n");
|
||||
var child, children = aSeq.GetElements();
|
||||
var m = 0;
|
||||
while (children.hasMoreElements()) {
|
||||
m += 1;
|
||||
child = children.getNext();
|
||||
child.QueryInterface(nsIRDFResource);
|
||||
}
|
||||
}
|
||||
this.mSourceDoc = document.implementation.createDocument('', '', null);
|
||||
this.mSourceDoc.addEventListener("load",this.onload(1),false);
|
||||
this.mSourceDoc.load(xalan_fl+".xml");
|
||||
this.mStyleDoc = document.implementation.createDocument('', '', null);
|
||||
this.mStyleDoc.addEventListener("load",this.styleLoaded(),false);
|
||||
this.mStyleDoc.load(xalan_fl+".xsl");
|
||||
},
|
||||
|
||||
// nsIWebProgressListener
|
||||
QueryInterface: function(aIID)
|
||||
{
|
||||
return this;
|
||||
},
|
||||
onStateChange: function(aProg, aRequest, aFlags, aStatus)
|
||||
{
|
||||
if ((aFlags & nsIWebProgListener.STATE_STOP) &&
|
||||
(aFlags & nsIWebProgListener.STATE_IS_DOCUMENT)) {
|
||||
aProg.removeProgressListener(this);
|
||||
this.mRefDoc = document.getElementById('hiddenHtml').contentDocument;
|
||||
this.fileLoaded(4);
|
||||
}
|
||||
},
|
||||
onProgressChange: function(aProg, b,c,d,e,f)
|
||||
{
|
||||
},
|
||||
onLocationChange: function(aProg, aRequest, aURI)
|
||||
{
|
||||
},
|
||||
onStatusChange: function(aProg, aRequest, aStatus, aMessage)
|
||||
{
|
||||
},
|
||||
onSecurityChange: function(aWebProgress, aRequest, aState)
|
||||
{
|
||||
},
|
||||
|
||||
// onload handler helper
|
||||
onload : function(file)
|
||||
{
|
||||
var self = this;
|
||||
return function(e)
|
||||
{
|
||||
return self.fileLoaded(file);
|
||||
};
|
||||
},
|
||||
|
||||
styleLoaded : function()
|
||||
{
|
||||
var self = this;
|
||||
return function(e)
|
||||
{
|
||||
return self.styleLoadedHelper();
|
||||
};
|
||||
},
|
||||
styleLoadedHelper : function()
|
||||
{
|
||||
var method = methodExpr.evaluate(this.mStyleDoc.documentElement, 2,
|
||||
null).stringValue;
|
||||
var refContent;
|
||||
if (!method) {
|
||||
// implicit method, guess from result
|
||||
refContent = this.loadTextFile(this.mRefURL);
|
||||
if (refContent.match(/^\s*<html/gi)) {
|
||||
method = 'html';
|
||||
}
|
||||
else {
|
||||
method = 'xml';
|
||||
}
|
||||
}
|
||||
this.mMethod = method;
|
||||
|
||||
switch (method) {
|
||||
case 'xml':
|
||||
if (!refContent) {
|
||||
refContent = this.loadTextFile(this.mRefURL);
|
||||
}
|
||||
this.mRefDoc = parser.parseFromString(refContent, 'application/xml');
|
||||
this.mLoaded += 4;
|
||||
break;
|
||||
case 'html':
|
||||
view.loadHtml(this.mRefURL, this);
|
||||
break;
|
||||
case 'text':
|
||||
if (!refContent) {
|
||||
refContent = this.loadTextFile(this.mRefURL);
|
||||
}
|
||||
const ns = 'http://www.mozilla.org/TransforMiix';
|
||||
const qn = 'transformiix:result';
|
||||
this.mRefDoc =
|
||||
document.implementation.createDocument(ns, qn, null);
|
||||
var txt = this.mRefDoc.createTextNode(refContent);
|
||||
this.mRefDoc.documentElement.appendChild(txt);
|
||||
this.mLoaded += 4;
|
||||
break;
|
||||
default:
|
||||
throw "unkown XSLT output method";
|
||||
}
|
||||
this.fileLoaded(2)
|
||||
},
|
||||
|
||||
fileLoaded : function(mask)
|
||||
{
|
||||
this.mLoaded += mask;
|
||||
if (this.mLoaded < 7) {
|
||||
return;
|
||||
}
|
||||
this.doTransform();
|
||||
},
|
||||
|
||||
doTransform : function()
|
||||
{
|
||||
this.kProcessor.reset();
|
||||
try {
|
||||
this.kProcessor.importStylesheet(this.mStyleDoc);
|
||||
this.mResDoc =
|
||||
this.kProcessor.transformToDocument(this.mSourceDoc);
|
||||
this.mRefDoc.normalize();
|
||||
isGood = DiffDOM(this.mResDoc.documentElement,
|
||||
this.mRefDoc.documentElement,
|
||||
this.mMethod == 'html');
|
||||
} catch (e) {
|
||||
isGood = false;
|
||||
};
|
||||
dump("This succeeded. "+isGood+"\n");
|
||||
isGood = isGood.toString();
|
||||
for (var i=0; i<this.kObservers.length; i++) {
|
||||
var aObs = this.kObservers[i];
|
||||
if (typeof(aObs)=='object' && typeof(aObs.observe)=='function') {
|
||||
aObs.observe(this.mResource, 'success', isGood);
|
||||
}
|
||||
else if (typeof(aObs)=='function') {
|
||||
aObs(this.mResource, 'success', isGood);
|
||||
}
|
||||
}
|
||||
if (this.mObserver) {
|
||||
if (typeof(this.mObserver)=='object') {
|
||||
this.mObserver.observe(this.mResource, 'success', isGood);
|
||||
}
|
||||
else {
|
||||
this.mObserver(this.mResource, 'success', isGood);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
loadTextFile : function(url)
|
||||
{
|
||||
var serv = Components.classes[IOSERVICE_CTRID].
|
||||
getService(nsIIOService);
|
||||
if (!serv) {
|
||||
throw Components.results.ERR_FAILURE;
|
||||
}
|
||||
var chan = serv.newChannel(url, null, null);
|
||||
var instream = doCreate(SIS_CTRID, nsISIS);
|
||||
instream.init(chan.open());
|
||||
|
||||
return instream.read(instream.available());
|
||||
}
|
||||
}
|
||||
|
||||
runItem.prototype.kXalan.QueryInterface(nsIStandardURL);
|
||||
|
||||
var cmdTestController =
|
||||
{
|
||||
supportsCommand: function(aCommand)
|
||||
{
|
||||
switch(aCommand) {
|
||||
case 'cmd_tst_run':
|
||||
case 'cmd_tst_runall':
|
||||
return true;
|
||||
default:
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isCommandEnabled: function(aCommand)
|
||||
{
|
||||
return this.supportsCommand(aCommand);
|
||||
},
|
||||
doCommand: function(aCommand)
|
||||
{
|
||||
switch(aCommand) {
|
||||
case 'cmd_tst_run':
|
||||
dump("cmd_tst_run\n");
|
||||
break;
|
||||
case 'cmd_tst_runall':
|
||||
dump("cmd_tst_runall\n");
|
||||
var tst_run = document.getElementById('cmd_tst_run');
|
||||
tst_run.doCommand();
|
||||
default:
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
registerController(cmdTestController);
|
@ -1,227 +0,0 @@
|
||||
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Axel Hecht.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Axel Hecht <axel@pike.org>
|
||||
* Peter Van der Beken <peterv@propagandism.org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
var view =
|
||||
{
|
||||
onRun : function()
|
||||
{
|
||||
runQueue.mArray = new Array();
|
||||
var sels = this.boxObject.view.selection,a=new Object(),b=new Object(),k;
|
||||
var rowResource, name, path;
|
||||
for (k=0;k<sels.getRangeCount();k++){
|
||||
sels.getRangeAt(k,a,b);
|
||||
for (var l=a.value;l<=b.value;l++) {
|
||||
rowResource = this.builder.getResourceAtIndex(l);
|
||||
itemCache.getItem(rowResource);
|
||||
}
|
||||
}
|
||||
runQueue.run();
|
||||
},
|
||||
displayTest : function()
|
||||
{
|
||||
var current = this.boxObject.view.selection.currentIndex;
|
||||
var rowResource = this.builder.getResourceAtIndex(current);
|
||||
var item = itemCache.getItem(rowResource);
|
||||
},
|
||||
browseForRDF : function()
|
||||
{
|
||||
var fp = doCreateRDFFP('Xalan Description File',
|
||||
nsIFilePicker.modeOpen);
|
||||
var res = fp.show();
|
||||
|
||||
if (res == nsIFilePicker.returnOK) {
|
||||
var furl = fp.fileURL;
|
||||
this.setDataSource(fp.fileURL.spec);
|
||||
}
|
||||
},
|
||||
dump_Good : function()
|
||||
{
|
||||
var enumi = this.mResultDS.GetSources(krTypeSucc, kGood, true);
|
||||
var k = 0;
|
||||
while (enumi.hasMoreElements()) {
|
||||
k += 1;
|
||||
dump(enumi.getNext().QueryInterface(nsIRDFResource).Value+"\n");
|
||||
}
|
||||
dump("found "+k+" good tests\n");
|
||||
},
|
||||
prune_ds : function()
|
||||
{
|
||||
if (this.mResultDS) {
|
||||
this.mResultDS.QueryInterface(nsIRDFPurgeableDataSource).Sweep();
|
||||
}
|
||||
regressionStats.init()
|
||||
itemCache.mArray = new Array();
|
||||
},
|
||||
setDataSource : function(aSpec)
|
||||
{
|
||||
var baseSpec;
|
||||
if (aSpec) {
|
||||
baseSpec = aSpec;
|
||||
}
|
||||
else {
|
||||
baseSpec = document.getElementById("xalan_rdf").value;
|
||||
}
|
||||
if (this.mXalanDS && this.mXalanDS.URI == baseSpec) {
|
||||
this.mXalanDS.QueryInterface(nsIRDFRemoteDataSource);
|
||||
this.mXalanDS.Refresh(true);
|
||||
}
|
||||
else {
|
||||
if (this.mXalanDS) {
|
||||
this.database.RemoveDataSource(view.mXalanDS);
|
||||
}
|
||||
this.mXalanDS = kRDFSvc.GetDataSourceBlocking(baseSpec);
|
||||
if (!this.mXalanDS) {
|
||||
alert("Unable do load DataSource: "+baseSpec);
|
||||
return;
|
||||
}
|
||||
this.database.AddDataSource(this.mXalanDS);
|
||||
}
|
||||
regressionStats.init();
|
||||
if (!this.mResultDS) {
|
||||
this.mResultDS = doCreate(kRDFInMemContractID,
|
||||
nsIRDFDataSource);
|
||||
this.database.AddDataSource(view.mResultDS);
|
||||
if (!this.mResultDS) {
|
||||
alert("Unable to create result InMemDatasource");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.builder.rebuild();
|
||||
document.getElementById("xalan_rdf").value = baseSpec;
|
||||
runItem.prototype.kXalan.init(runItem.prototype.kXalan.URLTYPE_STANDARD,
|
||||
0, baseSpec, null, null);
|
||||
},
|
||||
loadHtml : function(aUrl, aListener)
|
||||
{
|
||||
const nsIIRequestor = Components.interfaces.nsIInterfaceRequestor;
|
||||
const nsIWebProgress = Components.interfaces.nsIWebProgress;
|
||||
var req = this.mIframe.webNavigation.QueryInterface(nsIIRequestor);
|
||||
var prog = req.getInterface(nsIWebProgress);
|
||||
prog.addProgressListener(aListener, nsIWebProgress.NOTIFY_ALL);
|
||||
this.mIframe.webNavigation.loadURI(aUrl, 0,null,null,null);
|
||||
},
|
||||
fillItemContext : function()
|
||||
{
|
||||
var index = view.boxObject.view.selection.currentIndex;
|
||||
var res = view.builder.getResourceAtIndex(index);
|
||||
var purp = view.mXalanDS.GetTarget(res, krTypePurp, true);
|
||||
return (purp != null);
|
||||
}
|
||||
}
|
||||
|
||||
regressionStats =
|
||||
{
|
||||
observe: function(aSubject, aTopic, aData)
|
||||
{
|
||||
if (aTopic != 'success') {
|
||||
return;
|
||||
}
|
||||
var arc = (aData == "true") ? krTypeSuccCount : krTypeFailCount;
|
||||
this.assertNewCount(aSubject, arc, 1);
|
||||
},
|
||||
init: function()
|
||||
{
|
||||
if (this.mRegressionDS) {
|
||||
this.mRegressionDS.QueryInterface(nsIRDFPurgeableDataSource).Sweep();
|
||||
}
|
||||
else {
|
||||
this.mRegressionDS =
|
||||
doCreate(kRDFInMemContractID, nsIRDFDataSource);
|
||||
view.database.AddDataSource(this.mRegressionDS);
|
||||
}
|
||||
},
|
||||
getParent: function(aDS, aSource)
|
||||
{
|
||||
// parent chached?
|
||||
var parent = this.mRegressionDS.GetTarget(aSource, krTypeParent, true);
|
||||
if (!parent) {
|
||||
var labels = view.mXalanDS.ArcLabelsIn(aSource);
|
||||
while (labels.hasMoreElements()) {
|
||||
var arc = labels.getNext().QueryInterface(nsIRDFResource);
|
||||
if (arc.Value.match(this.mChildRE)) {
|
||||
parent = view.mXalanDS.GetSource(arc, aSource, true);
|
||||
// cache the parent
|
||||
this.mRegressionDS.Assert(aSource, krTypeParent,
|
||||
parent, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
return parent;
|
||||
},
|
||||
assertNewCount: function(aSource, aArc, aIncrement)
|
||||
{
|
||||
var root = kRDFSvc.GetResource('urn:root');
|
||||
var count = 0;
|
||||
// parent chached?
|
||||
var parent = this.getParent(view.XalanDS, aSource);
|
||||
while (parent && !parent.EqualsNode(root)) {
|
||||
var countRes = view.mResultDS.GetTarget(parent, aArc, true);
|
||||
if (countRes) {
|
||||
count = countRes.QueryInterface(nsIRDFInt).Value;
|
||||
}
|
||||
var newCountRes = kRDFSvc.GetIntLiteral(count + aIncrement);
|
||||
if (!newCountRes) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (countRes) {
|
||||
view.mResultDS.Change(parent, aArc, countRes, newCountRes);
|
||||
}
|
||||
else {
|
||||
view.mResultDS.Assert(parent, aArc, newCountRes, true);
|
||||
}
|
||||
parent = this.getParent(view.XalanDS, parent);
|
||||
}
|
||||
},
|
||||
mRegressionDS: 0,
|
||||
mChildRE: /http:\/\/www\.w3\.org\/1999\/02\/22-rdf-syntax-ns#_/
|
||||
}
|
||||
|
||||
function rdfObserve(aSubject, aTopic, aData)
|
||||
{
|
||||
if (aTopic == "success") {
|
||||
var target = (aData == "true") ? kGood : kBad;
|
||||
view.mResultDS.Assert(aSubject, krTypeSucc, target, true);
|
||||
|
||||
regressionStats.observe(aSubject, aTopic, aData);
|
||||
}
|
||||
}
|
||||
|
||||
runItem.prototype.kObservers.push(rdfObserve);
|
@ -1,53 +0,0 @@
|
||||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Axel Hecht.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Axel Hecht <axel@pike.org> (Original Author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
label.head {
|
||||
padding: 5px;
|
||||
font-size: medium;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
treechildren::-moz-tree-cell(success yes)
|
||||
{
|
||||
background-color: green ;
|
||||
}
|
||||
|
||||
treechildren::-moz-tree-cell(success no)
|
||||
{
|
||||
background-color: red ;
|
||||
}
|
@ -1,227 +0,0 @@
|
||||
<?xml version="1.0"?><!-- -*- Mode: xml; tab-width: 2; indent-tabs-mode: nil -*- -->
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla Public License Version
|
||||
- 1.1 (the "License"); you may not use this file except in compliance with
|
||||
- the License. You may obtain a copy of the License at
|
||||
- http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS IS" basis,
|
||||
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
- for the specific language governing rights and limitations under the
|
||||
- License.
|
||||
-
|
||||
- The Original Code is TransforMiiX XSLT processor code.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- Axel Hecht.
|
||||
- Portions created by the Initial Developer are Copyright (C) 2002
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
- Axel Hecht <axel@pike.org> (Original Author)
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="buster.css" type="text/css"?>
|
||||
|
||||
<?xul-overlay href="chrome://global/content/globalOverlay.xul"?>
|
||||
<?xul-overlay href="chrome://communicator/content/utilityOverlay.xul"?>
|
||||
|
||||
<window id="XalanBuster"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="onLoad()" onunload="onUnload()"
|
||||
title="Xalan testcase harness"
|
||||
persist="width,height"
|
||||
orient="vertical">
|
||||
<script type="application/x-javascript" src="buster-statics.js" />
|
||||
<script type="application/x-javascript" src="buster-test.js" />
|
||||
<script type="application/x-javascript" src="buster-view.js" />
|
||||
<script type="application/x-javascript" src="buster-handlers.js" />
|
||||
<script type="application/x-javascript" src="result-view.js" />
|
||||
<script type="application/x-javascript" src="buster-files.js" />
|
||||
<script type="application/x-javascript" src="DumpDOM.js" />
|
||||
<script type="application/x-javascript" src="DiffDOM.js" />
|
||||
|
||||
<commands id="busterKing">
|
||||
<commandset id="buster_file_cmds">
|
||||
<command id="cmd_fl_save" oncommand="goDoCommand('cmd_fl_save')" />
|
||||
<command id="cmd_fl_import" oncommand="goDoCommand('cmd_fl_import')"/>
|
||||
</commandset>
|
||||
<commandset id="buster_test_cmds">
|
||||
<command id="cmd_tst_run" oncommand="goDoCommand('cmd_tst_run')" />
|
||||
<command id="cmd_tst_runall" oncommand="goDoCommand('cmd_tst_runall')" />
|
||||
</commandset>
|
||||
<commandset id="commands">
|
||||
<command id="cmd_quit"/>
|
||||
<command id="cmd_close" oncommand="window.close();"/>
|
||||
</commandset>
|
||||
</commands>
|
||||
|
||||
<keyset>
|
||||
<key id="key_quit"/>
|
||||
<key id="key_close"/>
|
||||
</keyset>
|
||||
|
||||
<broadcasterset>
|
||||
<broadcaster id="obs_orig_success" hidden="true"/>
|
||||
<broadcaster id="not_yet" disabled="true"/>
|
||||
</broadcasterset>
|
||||
|
||||
|
||||
<menubar>
|
||||
<menu id="menu_File" label="File" accesskey="f">
|
||||
<menupopup id="menu_FilePopup">
|
||||
<menuitem label="Save results ..." accesskey="s"
|
||||
observes="cmd_fl_save"/>
|
||||
<menuitem label="Import results ..." accesskey="i"
|
||||
observes="cmd_fl_import"/>
|
||||
<menuitem id="menu_close"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu id="busterTests" label="Tests" accesskey="t">
|
||||
<menupopup id="tests-popup">
|
||||
<menuitem label="run a test" accesskey="r"
|
||||
observes="cmd_tst_run"/>
|
||||
<menuitem label="run all tests" accesskey="a"
|
||||
observes="cmd_tst_runall"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
</menubar>
|
||||
|
||||
<popupset>
|
||||
<popup id="itemcontext" onpopupshowing="return view.fillItemContext();">
|
||||
<menuitem label="View Test" oncommand="onNewResultView(event)"/>
|
||||
</popup>
|
||||
</popupset>
|
||||
|
||||
<hbox>
|
||||
<button label="check all" oncommand="check(true)" observes="not_yet"/>
|
||||
<button label="uncheck all" oncommand="check(false)" observes="not_yet"/>
|
||||
<button label="reset success" oncommand="view.prune_ds()" />
|
||||
<button label="run checked tests" oncommand="view.onRun()" />
|
||||
</hbox>
|
||||
<hbox>
|
||||
<label value="Xalan index: " class="head"/>
|
||||
<textbox id="xalan_rdf" persist="url" crop="end" size="40"/>
|
||||
<button label="browse..." oncommand="view.browseForRDF()" />
|
||||
</hbox>
|
||||
<hbox>
|
||||
<groupbox orient="horizontal"><caption label="search" />
|
||||
<button label="Search for " oncommand="select()" observes="not_yet"/>
|
||||
<textbox style="width: 10em;" id="search-name" persist="value" /><label value=" in " />
|
||||
<menulist id="search-field" persist="data" observes="not_yet">
|
||||
<menupopup>
|
||||
<menuitem value="1" label="Name" />
|
||||
<menuitem value="2" label="Purpose" />
|
||||
<menuitem value="3" label="Comment" />
|
||||
</menupopup>
|
||||
</menulist>
|
||||
</groupbox>
|
||||
<spacer flex="1" /></hbox>
|
||||
|
||||
<tree id="out" flex="1" flags="dont-build-content" hidecolumnpicker="true"
|
||||
datasources="rdf:null" ref="urn:root" context="itemcontext">
|
||||
<treecols>
|
||||
<treecol id="NameColumn" flex="1" label="Name" sort="?name"
|
||||
primary="true" />
|
||||
<splitter class="tree-splitter" />
|
||||
<treecol id="PurpsColumn" flex="2" label="Purpose" sort="?purp" />
|
||||
<splitter class="tree-splitter" />
|
||||
<treecol id="SuccessColumn" flex="0" label="Success" />
|
||||
<splitter class="tree-splitter" observes="obs_orig_success" />
|
||||
<treecol id="OrigSuccessColumn" flex="0" label="Previously"
|
||||
observes="obs_orig_success" />
|
||||
</treecols>
|
||||
<template>
|
||||
<rule>
|
||||
<conditions>
|
||||
<content uri="?uri" />
|
||||
<member container="?uri" child="?subheading" />
|
||||
<triple subject="?subheading"
|
||||
predicate="http://home.netscape.com/NC-rdf#purp"
|
||||
object="?purp" />
|
||||
</conditions>
|
||||
|
||||
<bindings>
|
||||
<binding subject="?subheading"
|
||||
predicate="http://home.netscape.com/NC-rdf#name"
|
||||
object="?name" />
|
||||
<binding subject="?subheading"
|
||||
predicate="http://home.netscape.com/NC-rdf#succ"
|
||||
object="?succ" />
|
||||
<binding subject="?subheading"
|
||||
predicate="http://home.netscape.com/NC-rdf#orig_succ"
|
||||
object="?orig_succ" />
|
||||
</bindings>
|
||||
|
||||
<action>
|
||||
<treechildren>
|
||||
<treeitem uri="?subheading">
|
||||
<treerow>
|
||||
<treecell ref="NameColumn" label="?name" />
|
||||
<treecell ref="PurpsColumn" label="?purp" />
|
||||
<treecell ref="SuccessColumn" label="?succ"
|
||||
properties="success ?succ"/>
|
||||
<treecell ref="OrigSuccessColumn" label="?orig_succ"
|
||||
properties="success ?orig_succ" />
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</action>
|
||||
</rule>
|
||||
<rule>
|
||||
<conditions>
|
||||
<content uri="?uri" />
|
||||
<member container="?uri" child="?subheading" />
|
||||
</conditions>
|
||||
|
||||
<bindings>
|
||||
<binding subject="?subheading"
|
||||
predicate="http://home.netscape.com/NC-rdf#dir"
|
||||
object="?dir" />
|
||||
<binding subject="?subheading"
|
||||
predicate="http://home.netscape.com/NC-rdf#succCount"
|
||||
object="?succ" />
|
||||
<binding subject="?subheading"
|
||||
predicate="http://home.netscape.com/NC-rdf#failCount"
|
||||
object="?fail" />
|
||||
<binding subject="?subheading"
|
||||
predicate="http://home.netscape.com/NC-rdf#orig_succCount"
|
||||
object="?orig_succ" />
|
||||
<binding subject="?subheading"
|
||||
predicate="http://home.netscape.com/NC-rdf#orig_failCount"
|
||||
object="?orig_fail" />
|
||||
</bindings>
|
||||
|
||||
<action>
|
||||
<treechildren>
|
||||
<treeitem uri="?subheading">
|
||||
<treerow>
|
||||
<treecell ref="NameColumn" label="?dir" />
|
||||
<treecell ref="PurpsColumn" label="" />
|
||||
<treecell ref="SuccessColumn" label="?succ / ?fail" />
|
||||
<treecell ref="OrigSuccessColumn" label="?orig_succ / ?orig_fail" />
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
</tree>
|
||||
<iframe style="visibility:hidden; height:0px;" id="hiddenHtml" />
|
||||
</window>
|
@ -1,28 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
|
||||
|
||||
<!-- list all the packages being supplied by this jar -->
|
||||
<RDF:Seq about="urn:mozilla:package:root">
|
||||
<RDF:li resource="urn:mozilla:package:xslt-qa"/>
|
||||
</RDF:Seq>
|
||||
|
||||
<!-- package information -->
|
||||
<RDF:Description about="urn:mozilla:package:xslt-qa"
|
||||
chrome:displayName="XSLT QA Tools"
|
||||
chrome:author="mozilla.org"
|
||||
chrome:name="xslt-qa"
|
||||
#expand chrome:localeVersion="__MOZILLA_LOCALE_VERSION__"
|
||||
#expand chrome:skinVersion="__MOZILLA_SKIN_VERSION__">
|
||||
</RDF:Description>
|
||||
|
||||
<!-- overlay information -->
|
||||
<RDF:Seq about="urn:mozilla:overlays">
|
||||
<RDF:li resource="chrome://communicator/content/tasksOverlay.xul"/>
|
||||
</RDF:Seq>
|
||||
|
||||
<RDF:Seq about="chrome://communicator/content/tasksOverlay.xul">
|
||||
<RDF:li>chrome://xslt-qa/content/xslt-qa-overlay.xul</RDF:li>
|
||||
</RDF:Seq>
|
||||
|
||||
</RDF:RDF>
|
@ -1,95 +0,0 @@
|
||||
use File::Spec;
|
||||
|
||||
my(@chunks, @list, $entry, $main_cats, $spacing);
|
||||
@list = ('conf', 'perf');
|
||||
foreach $entry (@list) {
|
||||
$main_cats .= " <rdf:li><rdf:Description about=\"urn:x-buster:$entry\" nc:dir=\"$entry\" /></rdf:li>\n";
|
||||
go_in($entry, '', $entry);
|
||||
}
|
||||
if ($ARGV[0]) {
|
||||
open OUTPUT, ">$ARGV[0]";
|
||||
}
|
||||
else {
|
||||
open OUTPUT, ">xalan.rdf";
|
||||
};
|
||||
select(OUTPUT);
|
||||
print '<?xml version="1.0"?>
|
||||
|
||||
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:nc="http://home.netscape.com/NC-rdf#">
|
||||
<rdf:Seq about="urn:root">
|
||||
' . $main_cats . ' </rdf:Seq>
|
||||
';
|
||||
print join('',@chunks);
|
||||
print '</rdf:RDF>
|
||||
';
|
||||
exit 0;
|
||||
|
||||
sub go_in {
|
||||
my($current, $about, $cat) = @_;
|
||||
my (@list, $entry, @subdirs, @files, @purps, $rdf);
|
||||
chdir $current;
|
||||
@list = <*>;
|
||||
|
||||
LOOP: foreach $entry (@list) {
|
||||
next LOOP if $entry=~/^CVS$/;
|
||||
if (! -d $entry) {
|
||||
if ($entry=~/^($current.*)\.xsl$/) {
|
||||
local $source = $entry;
|
||||
$source=~s/xsl$/xml/;
|
||||
next LOOP if ! -f $source;
|
||||
$entry=~/^($current.*)\.xsl$/;
|
||||
push(@files, $1);
|
||||
local ($purp, $purp_open);
|
||||
open STYLE, $entry;
|
||||
$purp_open = 0;
|
||||
while (<STYLE>) {
|
||||
if (/<!--\s+purpose: (.+)\s*-->/i) {
|
||||
$purp .= $1;
|
||||
}
|
||||
elsif (/<!--\s+purpose: (.+)\s*$/i) {
|
||||
$purp_open = 1;
|
||||
$purp .= $1;
|
||||
}
|
||||
elsif ($purp_open) {
|
||||
if (/\s*(\s.+)\s*-->/) {
|
||||
$purp_open = 0;
|
||||
$purp .= $1;
|
||||
}
|
||||
elsif (/\s*(\s.+)\s*$/) {
|
||||
$purp .= $1;
|
||||
}
|
||||
}
|
||||
}
|
||||
$purp=~s/"/'/g; $purp=~s/&/&/g; $purp=~s/</</g;
|
||||
$purp=~s/\r/ /g; $purp=~s/\s\s/ /g; $purp=~s/\s$//g;
|
||||
push(@purps, $purp);
|
||||
}
|
||||
}
|
||||
else {
|
||||
push(@subdirs, $entry);
|
||||
}
|
||||
}
|
||||
|
||||
if (@subdirs > 0 || @files > 0) {
|
||||
my $topic = $about.$current; $topic=~s/\///g;
|
||||
$rdf = ' <rdf:Seq about="urn:x-buster:'.$topic."\">\n";
|
||||
foreach $entry (@subdirs) {
|
||||
if (go_in($entry, $about.$current.'/', $cat)) {
|
||||
my $id = 'urn:x-buster:'.$about.$current.$entry; $id=~s/\///g;
|
||||
$rdf .= " <rdf:li><rdf:Description about=\"$id\" nc:dir=\"$entry\" /></rdf:li>\n";
|
||||
}
|
||||
}
|
||||
for (my $i=0; $i < @files; $i++) {
|
||||
my $uri = $about.$current.'/'.$files[$i];
|
||||
$uri=~s/[^\/]+\///;
|
||||
my $id = $uri; $id=~s/\///g;
|
||||
$rdf .= " <rdf:li><rdf:Description about=\"urn:x-buster:$files[$i]\" nc:name=\"$files[$i]\" nc:purp=\"$purps[$i]\" nc:path=\"$uri\" nc:category=\"$cat\" /></rdf:li>\n";
|
||||
}
|
||||
$rdf .= " </rdf:Seq>\n";
|
||||
push(@chunks, $rdf);
|
||||
}
|
||||
|
||||
chdir File::Spec->updir;
|
||||
return (@subdirs > 0 || @files > 0);
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
const X_APP = "Buster";
|
||||
const X_VER = "2.0"
|
||||
const X_JAR_FILE = "xslt-qa.jar";
|
||||
|
||||
var err = initInstall("Install " + X_APP, X_APP, X_VER);
|
||||
logComment("initInstall: " + err);
|
||||
logComment( "Installation started ..." );
|
||||
addFile("We're on our way ...", X_JAR_FILE, getFolder("chrome"), "");
|
||||
registerChrome(CONTENT|DELAYED_CHROME, getFolder("chrome", X_JAR_FILE), "content/xslt-qa/");
|
||||
err = getLastError();
|
||||
if (err == SUCCESS) {
|
||||
performInstall();
|
||||
alert("Please restart Mozilla");
|
||||
}
|
||||
else {
|
||||
cancelInstall();
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
xslt-qa.jar:
|
||||
* content/xslt-qa/contents.rdf (contents.rdf)
|
||||
content/xslt-qa/xslt-qa-overlay.xul
|
||||
content/xslt-qa/xslt-qa-overlay.js
|
||||
content/xslt-qa/buster/buster.xul
|
||||
content/xslt-qa/buster/buster.css
|
||||
content/xslt-qa/buster/buster-statics.js
|
||||
content/xslt-qa/buster/buster-handlers.js
|
||||
content/xslt-qa/buster/buster-files.js
|
||||
content/xslt-qa/buster/buster-test.js
|
||||
content/xslt-qa/buster/buster-view.js
|
||||
content/xslt-qa/buster/result-view.xul
|
||||
content/xslt-qa/buster/result-inspector.xul
|
||||
content/xslt-qa/buster/result-view.css
|
||||
content/xslt-qa/buster/result-view.js
|
||||
content/xslt-qa/buster/DumpDOM.js
|
||||
content/xslt-qa/buster/DiffDOM.js
|
@ -1,70 +0,0 @@
|
||||
<?xml version="1.0"?><!-- -*- Mode: xml; tab-width: 2; indent-tabs-mode: nil -*- -->
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla Public License Version
|
||||
- 1.1 (the "License"); you may not use this file except in compliance with
|
||||
- the License. You may obtain a copy of the License at
|
||||
- http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS IS" basis,
|
||||
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
- for the specific language governing rights and limitations under the
|
||||
- License.
|
||||
-
|
||||
- The Original Code is TransforMiiX XSLT processor code.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- Netscape Communications Corporation.
|
||||
- Portions created by the Initial Developer are Copyright (C) 2002
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
- Peter Van der Beken <peterv@propagandism.org>
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<!DOCTYPE window [
|
||||
<!ENTITY % dtd1 SYSTEM "chrome://inspector/locale/inspector.dtd"> %dtd1;
|
||||
<!ENTITY % dtd2 SYSTEM "chrome://inspector/content/util.dtd"> %dtd2;
|
||||
]>
|
||||
|
||||
<?xul-overlay href="chrome://inspector/content/commandOverlay.xul"?>
|
||||
<?xul-overlay href="chrome://inspector/content/keysetOverlay.xul"?>
|
||||
<?xul-overlay href="chrome://inspector/content/popupOverlay.xul"?>
|
||||
|
||||
<?xml-stylesheet href="chrome://inspector/skin/inspectorWindow.css"?>
|
||||
|
||||
<window class="color-dialog"
|
||||
title="&Inspector.title;"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<script type="application/x-javascript" src="chrome://inspector/content/ViewerRegistry.js"/>
|
||||
<script type="application/x-javascript" src="chrome://inspector/content/utils.js"/>
|
||||
<script type="application/x-javascript" src="chrome://inspector/content/jsutil/xpcom/XPCU.js"/>
|
||||
<script type="application/x-javascript" src="chrome://inspector/content/jsutil/rdf/RDFU.js"/>
|
||||
<script type="application/x-javascript" src="chrome://inspector/content/jsutil/rdf/RDFArray.js"/>
|
||||
<script type="application/x-javascript" src="chrome://inspector/content/jsutil/events/ObserverManager.js"/>
|
||||
<script type="application/x-javascript" src="chrome://inspector/content/jsutil/xul/FrameExchange.js"/>
|
||||
|
||||
<commandset id="cmdsGlobalCommands"/>
|
||||
<keyset id="ksGlobalKeyset"/>
|
||||
<popupset id="ppsViewerPopupset"/>
|
||||
|
||||
<domi-panelset id="bxPanelSet" flex="1" viewercommandset="cmdsGlobalCommands">
|
||||
<domi-panel title="&bxDocPanel.title;" flex="1"/>
|
||||
</domi-panelset>
|
||||
|
||||
</window>
|
@ -1,16 +0,0 @@
|
||||
label.heading {
|
||||
font-size: medium;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
button.close {
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
iframe {
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
vbox.hidden {
|
||||
display: none;
|
||||
}
|
@ -1,139 +0,0 @@
|
||||
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Axel Hecht.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Axel Hecht <axel@pike.org>
|
||||
* Peter Van der Beken <peterv@propagandism.org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
function onNewResultView(event)
|
||||
{
|
||||
dump("onNewResultView\n");
|
||||
const db = runItem.prototype.kDatabase;
|
||||
const kXalan = runItem.prototype.kXalan;
|
||||
var index = view.boxObject.view.selection.currentIndex;
|
||||
var res = view.builder.getResourceAtIndex(index);
|
||||
var name = db.GetTarget(res, krTypeName, true);
|
||||
if (!name) {
|
||||
return false;
|
||||
}
|
||||
var cat = db.GetTarget(res, krTypeCat, true);
|
||||
var path = db.GetTarget(res, krTypePath, true);
|
||||
cat = cat.QueryInterface(nsIRDFLiteral);
|
||||
name = name.QueryInterface(nsIRDFLiteral);
|
||||
path = path.QueryInterface(nsIRDFLiteral);
|
||||
xalan_fl = kXalan.resolve(cat.Value+"/"+path.Value);
|
||||
xalan_ref = kXalan.resolve(cat.Value+"-gold/"+path.Value);
|
||||
var currentResultItem = new Object();
|
||||
currentResultItem.testpath = xalan_fl;
|
||||
currentResultItem.refpath = xalan_ref;
|
||||
var currentRunItem = itemCache.getItem(res);
|
||||
// XXX todo, keep a list of these windows, so that we can close them.
|
||||
resultWin = window.openDialog('result-view.xul','_blank',
|
||||
'chrome,resizable,dialog=no',
|
||||
currentResultItem, currentRunItem);
|
||||
return true;
|
||||
}
|
||||
|
||||
var refInspector;
|
||||
var resInspector;
|
||||
|
||||
function onResultViewLoad(event)
|
||||
{
|
||||
dump("onResultViewLoad\n");
|
||||
aResultItem = window.arguments[0];
|
||||
aRunItem = window.arguments[1];
|
||||
var loadFlags = Components.interfaces.nsIWebNavigation.LOAD_FLAGS_NONE;
|
||||
document.getElementById('src').webNavigation.loadURI('view-source:'+
|
||||
aResultItem.testpath+'.xml', loadFlags, null, null, null);
|
||||
document.getElementById('style').webNavigation.loadURI('view-source:'+
|
||||
aResultItem.testpath+'.xsl', loadFlags, null, null, null);
|
||||
|
||||
if (aRunItem && aRunItem.mRefDoc && aRunItem.mResDoc) {
|
||||
document.getElementById("refSourceBox").setAttribute("class", "hidden");
|
||||
refInspector = new ObjectApp();
|
||||
refInspector.initialize("refInsp", aRunItem.mRefDoc);
|
||||
resInspector = new ObjectApp();
|
||||
resInspector.initialize("resInsp", aRunItem.mResDoc);
|
||||
}
|
||||
else {
|
||||
document.getElementById("inspectorBox").setAttribute("class", "hidden");
|
||||
document.getElementById('ref').webNavigation.loadURI('view-source:'+
|
||||
aResultItem.refpath+'.out', loadFlags, null, null, null);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function onResultViewUnload(event)
|
||||
{
|
||||
dump("onResultUnload\n");
|
||||
}
|
||||
|
||||
function ObjectApp()
|
||||
{
|
||||
}
|
||||
|
||||
ObjectApp.prototype =
|
||||
{
|
||||
mDoc: null,
|
||||
mPanelSet: null,
|
||||
|
||||
initialize: function(aId, aDoc)
|
||||
{
|
||||
this.mDoc = aDoc;
|
||||
this.mPanelSet = document.getElementById(aId).contentDocument.getElementById("bxPanelSet");
|
||||
this.mPanelSet.addObserver("panelsetready", this, false);
|
||||
this.mPanelSet.initialize();
|
||||
},
|
||||
|
||||
doViewerCommand: function(aCommand)
|
||||
{
|
||||
this.mPanelSet.execCommand(aCommand);
|
||||
},
|
||||
|
||||
getViewer: function(aUID)
|
||||
{
|
||||
return this.mPanelSet.registry.getViewerByUID(aUID);
|
||||
},
|
||||
|
||||
onEvent: function(aEvent)
|
||||
{
|
||||
switch (aEvent.type) {
|
||||
case "panelsetready":
|
||||
{
|
||||
this.mPanelSet.getPanel(0).subject = this.mDoc;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
@ -1,79 +0,0 @@
|
||||
<?xml version="1.0"?><!-- -*- Mode: xml; tab-width: 2; indent-tabs-mode: nil -*- -->
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla Public License Version
|
||||
- 1.1 (the "License"); you may not use this file except in compliance with
|
||||
- the License. You may obtain a copy of the License at
|
||||
- http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS IS" basis,
|
||||
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
- for the specific language governing rights and limitations under the
|
||||
- License.
|
||||
-
|
||||
- The Original Code is TransforMiiX XSLT processor code.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- Axel Hecht.
|
||||
- Portions created by the Initial Developer are Copyright (C) 2002
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
- Axel Hecht <axel@pike.org> (Original Author)
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="result-view.css" type="text/css"?>
|
||||
|
||||
<window id="buster-result-view" title="Xalan testcase details"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
orient="vertical" persist="width height"
|
||||
onload="onResultViewLoad()" onunload="onResultViewUnload()">
|
||||
<script type="application/x-javascript" src="DumpDOM.js" />
|
||||
<script type="application/x-javascript" src="buster-statics.js" />
|
||||
<script type="application/x-javascript" src="buster-test.js" />
|
||||
<script type="application/x-javascript" src="result-view.js" />
|
||||
|
||||
<hbox>
|
||||
<button class="close" label="close this window"
|
||||
oncommand="window.close()" />
|
||||
</hbox>
|
||||
<vbox flex="1">
|
||||
<label class="heading" value="XML Source:" />
|
||||
<iframe flex="1" id="src" />
|
||||
</vbox>
|
||||
<vbox flex="1">
|
||||
<label class="heading" value="XSL Source:" />
|
||||
<iframe flex="1" id="style" />
|
||||
</vbox>
|
||||
<vbox flex="1" id="refSourceBox">
|
||||
<label class="heading" value="Reference Source:" />
|
||||
<iframe flex="1" id="ref" />
|
||||
</vbox>
|
||||
<vbox flex="2" id="inspectorBox">
|
||||
<hbox flex="1">
|
||||
<vbox flex="1">
|
||||
<label class="heading" value="Reference" />
|
||||
<iframe flex="1" id="refInsp" src="result-inspector.xul" />
|
||||
</vbox>
|
||||
<vbox flex="1">
|
||||
<label class="heading" value="Result" />
|
||||
<iframe flex="1" id="resInsp" src="result-inspector.xul" />
|
||||
</vbox>
|
||||
</hbox>
|
||||
</vbox>
|
||||
</window>
|
@ -1,44 +0,0 @@
|
||||
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Axel Hecht.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Axel Hecht <axel@pike.org>
|
||||
* Peter Van der Beken <peterv@propagandism.org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
function onStartBuster()
|
||||
{
|
||||
window.open('chrome://xslt-qa/content/buster/buster.xul',
|
||||
'buster', 'chrome,resizable');
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
<?xml version="1.0"?><!-- -*- Mode: xml; tab-width: 2; indent-tabs-mode: nil -*- -->
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla Public License Version
|
||||
- 1.1 (the "License"); you may not use this file except in compliance with
|
||||
- the License. You may obtain a copy of the License at
|
||||
- http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS IS" basis,
|
||||
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
- for the specific language governing rights and limitations under the
|
||||
- License.
|
||||
-
|
||||
- The Original Code is TransforMiiX XSLT processor code.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- Axel Hecht.
|
||||
- Portions created by the Initial Developer are Copyright (C) 2002
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
- Axel Hecht <axel@pike.org> (Original Author)
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<overlay id="xsltToolsMenuID"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script src="xslt-qa-overlay.js" />
|
||||
<menupopup id="toolsPopup">
|
||||
<menuitem label="Xalan Tests" oncommand="onStartBuster()"/>
|
||||
</menupopup>
|
||||
</overlay>
|
@ -1 +0,0 @@
|
||||
Makefile
|
@ -1,51 +0,0 @@
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is TransforMiiX XSLT processor code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Axel Hecht.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2001
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Axel Hecht <axel@pike.org>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = base xml xpath xslt
|
||||
|
||||
ifdef TX_EXE
|
||||
DIRS += lib main
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
@ -1 +0,0 @@
|
||||
Makefile
|
@ -1,353 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The MITRE Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1999
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsString.h"
|
||||
#include "txCore.h"
|
||||
#include "XMLUtils.h"
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef WIN32
|
||||
#include <float.h>
|
||||
#endif
|
||||
#include "prdtoa.h"
|
||||
|
||||
/*
|
||||
* Utility class for doubles
|
||||
*/
|
||||
|
||||
//A trick to handle IEEE floating point exceptions on FreeBSD - E.D.
|
||||
#ifdef __FreeBSD__
|
||||
#include <ieeefp.h>
|
||||
#ifdef __alpha__
|
||||
fp_except_t allmask = FP_X_INV|FP_X_OFL|FP_X_UFL|FP_X_DZ|FP_X_IMP;
|
||||
#else
|
||||
fp_except_t allmask = FP_X_INV|FP_X_OFL|FP_X_UFL|FP_X_DZ|FP_X_IMP|FP_X_DNML;
|
||||
#endif
|
||||
fp_except_t oldmask = fpsetmask(~allmask);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Macros to workaround math-bugs bugs in various platforms
|
||||
*/
|
||||
|
||||
/**
|
||||
* Stefan Hanske <sh990154@mail.uni-greifswald.de> reports:
|
||||
* ARM is a little endian architecture but 64 bit double words are stored
|
||||
* differently: the 32 bit words are in little endian byte order, the two words
|
||||
* are stored in big endian`s way.
|
||||
*/
|
||||
|
||||
#if defined(__arm) || defined(__arm32__) || defined(_arm26__) || defined(__arm__)
|
||||
#define CPU_IS_ARM
|
||||
#endif
|
||||
|
||||
#if (__GNUC__ == 2 && __GNUC_MINOR__ > 95) || __GNUC__ > 2
|
||||
/**
|
||||
* This version of the macros is safe for the alias optimizations
|
||||
* that gcc does, but uses gcc-specific extensions.
|
||||
*/
|
||||
|
||||
typedef union txdpun {
|
||||
PRFloat64 d;
|
||||
struct {
|
||||
#if defined(IS_LITTLE_ENDIAN) && !defined(CPU_IS_ARM)
|
||||
PRUint32 lo, hi;
|
||||
#else
|
||||
PRUint32 hi, lo;
|
||||
#endif
|
||||
} s;
|
||||
} txdpun;
|
||||
|
||||
#define TX_DOUBLE_HI32(x) (__extension__ ({ txdpun u; u.d = (x); u.s.hi; }))
|
||||
#define TX_DOUBLE_LO32(x) (__extension__ ({ txdpun u; u.d = (x); u.s.lo; }))
|
||||
|
||||
#else // __GNUC__
|
||||
|
||||
/* We don't know of any non-gcc compilers that perform alias optimization,
|
||||
* so this code should work.
|
||||
*/
|
||||
|
||||
#if defined(IS_LITTLE_ENDIAN) && !defined(CPU_IS_ARM)
|
||||
#define TX_DOUBLE_HI32(x) (((PRUint32 *)&(x))[1])
|
||||
#define TX_DOUBLE_LO32(x) (((PRUint32 *)&(x))[0])
|
||||
#else
|
||||
#define TX_DOUBLE_HI32(x) (((PRUint32 *)&(x))[0])
|
||||
#define TX_DOUBLE_LO32(x) (((PRUint32 *)&(x))[1])
|
||||
#endif
|
||||
|
||||
#endif // __GNUC__
|
||||
|
||||
#define TX_DOUBLE_HI32_SIGNBIT 0x80000000
|
||||
#define TX_DOUBLE_HI32_EXPMASK 0x7ff00000
|
||||
#define TX_DOUBLE_HI32_MANTMASK 0x000fffff
|
||||
|
||||
//-- Initialize Double related constants
|
||||
#ifdef IS_BIG_ENDIAN
|
||||
const PRUint32 nanMask[2] = {TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_MANTMASK,
|
||||
0xffffffff};
|
||||
const PRUint32 infMask[2] = {TX_DOUBLE_HI32_EXPMASK, 0};
|
||||
const PRUint32 negInfMask[2] = {TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_SIGNBIT, 0};
|
||||
#else
|
||||
const PRUint32 nanMask[2] = {0xffffffff,
|
||||
TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_MANTMASK};
|
||||
const PRUint32 infMask[2] = {0, TX_DOUBLE_HI32_EXPMASK};
|
||||
const PRUint32 negInfMask[2] = {0, TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_SIGNBIT};
|
||||
#endif
|
||||
|
||||
const double Double::NaN = *((double*)nanMask);
|
||||
const double Double::POSITIVE_INFINITY = *((double*)infMask);
|
||||
const double Double::NEGATIVE_INFINITY = *((double*)negInfMask);
|
||||
|
||||
/*
|
||||
* Determines whether the given double represents positive or negative
|
||||
* inifinity
|
||||
*/
|
||||
MBool Double::isInfinite(double aDbl)
|
||||
{
|
||||
return ((TX_DOUBLE_HI32(aDbl) & ~TX_DOUBLE_HI32_SIGNBIT) == TX_DOUBLE_HI32_EXPMASK &&
|
||||
!TX_DOUBLE_LO32(aDbl));
|
||||
}
|
||||
|
||||
/*
|
||||
* Determines whether the given double is NaN
|
||||
*/
|
||||
MBool Double::isNaN(double aDbl)
|
||||
{
|
||||
return ((TX_DOUBLE_HI32(aDbl) & TX_DOUBLE_HI32_EXPMASK) == TX_DOUBLE_HI32_EXPMASK &&
|
||||
(TX_DOUBLE_LO32(aDbl) || (TX_DOUBLE_HI32(aDbl) & TX_DOUBLE_HI32_MANTMASK)));
|
||||
}
|
||||
|
||||
/*
|
||||
* Determines whether the given double is negative
|
||||
*/
|
||||
MBool Double::isNeg(double aDbl)
|
||||
{
|
||||
return (TX_DOUBLE_HI32(aDbl) & TX_DOUBLE_HI32_SIGNBIT) != 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Converts the given String to a double, if the String value does not
|
||||
* represent a double, NaN will be returned
|
||||
*/
|
||||
class txStringToDouble
|
||||
{
|
||||
public:
|
||||
typedef PRUnichar input_type;
|
||||
typedef PRUnichar value_type;
|
||||
txStringToDouble(): mState(eWhitestart), mSign(ePositive) {}
|
||||
|
||||
PRUint32
|
||||
write(const input_type* aSource, PRUint32 aSourceLength)
|
||||
{
|
||||
if (mState == eIllegal) {
|
||||
return aSourceLength;
|
||||
}
|
||||
PRUint32 i = 0;
|
||||
PRUnichar c;
|
||||
for ( ; i < aSourceLength; ++i) {
|
||||
c = aSource[i];
|
||||
switch (mState) {
|
||||
case eWhitestart:
|
||||
if (c == '-') {
|
||||
mState = eDecimal;
|
||||
mSign = eNegative;
|
||||
}
|
||||
else if (c >= '0' && c <= '9') {
|
||||
mState = eDecimal;
|
||||
mBuffer.Append((char)c);
|
||||
}
|
||||
else if (c == '.') {
|
||||
mState = eMantissa;
|
||||
mBuffer.Append((char)c);
|
||||
}
|
||||
else if (!XMLUtils::isWhitespace(c)) {
|
||||
mState = eIllegal;
|
||||
return aSourceLength;
|
||||
}
|
||||
break;
|
||||
case eDecimal:
|
||||
if (c >= '0' && c <= '9') {
|
||||
mBuffer.Append((char)c);
|
||||
}
|
||||
else if (c == '.') {
|
||||
mState = eMantissa;
|
||||
mBuffer.Append((char)c);
|
||||
}
|
||||
else if (XMLUtils::isWhitespace(c)) {
|
||||
mState = eWhiteend;
|
||||
}
|
||||
else {
|
||||
mState = eIllegal;
|
||||
return aSourceLength;
|
||||
}
|
||||
break;
|
||||
case eMantissa:
|
||||
if (c >= '0' && c <= '9') {
|
||||
mBuffer.Append((char)c);
|
||||
}
|
||||
else if (XMLUtils::isWhitespace(c)) {
|
||||
mState = eWhiteend;
|
||||
}
|
||||
else {
|
||||
mState = eIllegal;
|
||||
return aSourceLength;
|
||||
}
|
||||
break;
|
||||
case eWhiteend:
|
||||
if (!XMLUtils::isWhitespace(c)) {
|
||||
mState = eIllegal;
|
||||
return aSourceLength;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return aSourceLength;
|
||||
}
|
||||
|
||||
double
|
||||
getDouble()
|
||||
{
|
||||
if (mState == eIllegal || mBuffer.IsEmpty() ||
|
||||
(mBuffer.Length() == 1 && mBuffer[0] == '.')) {
|
||||
return Double::NaN;
|
||||
}
|
||||
return mSign*PR_strtod(mBuffer.get(), 0);
|
||||
}
|
||||
private:
|
||||
nsCAutoString mBuffer;
|
||||
enum {
|
||||
eWhitestart,
|
||||
eDecimal,
|
||||
eMantissa,
|
||||
eWhiteend,
|
||||
eIllegal
|
||||
} mState;
|
||||
enum {
|
||||
eNegative = -1,
|
||||
ePositive = 1
|
||||
} mSign;
|
||||
};
|
||||
|
||||
double Double::toDouble(const nsAString& aSrc)
|
||||
{
|
||||
txStringToDouble sink;
|
||||
nsAString::const_iterator fromBegin, fromEnd;
|
||||
copy_string(aSrc.BeginReading(fromBegin), aSrc.EndReading(fromEnd), sink);
|
||||
return sink.getDouble();
|
||||
}
|
||||
|
||||
/*
|
||||
* Converts the value of the given double to a String, and places
|
||||
* The result into the destination String.
|
||||
* @return the given dest string
|
||||
*/
|
||||
void Double::toString(double aValue, nsAString& aDest)
|
||||
{
|
||||
|
||||
// check for special cases
|
||||
|
||||
if (isNaN(aValue)) {
|
||||
aDest.AppendLiteral("NaN");
|
||||
return;
|
||||
}
|
||||
if (isInfinite(aValue)) {
|
||||
if (aValue < 0)
|
||||
aDest.Append(PRUnichar('-'));
|
||||
aDest.AppendLiteral("Infinity");
|
||||
return;
|
||||
}
|
||||
|
||||
// Mantissa length is 17, so this is plenty
|
||||
const int buflen = 20;
|
||||
char buf[buflen];
|
||||
|
||||
PRIntn intDigits, sign;
|
||||
char* endp;
|
||||
PR_dtoa(aValue, 0, 0, &intDigits, &sign, &endp, buf, buflen - 1);
|
||||
|
||||
// compute length
|
||||
PRInt32 length = endp - buf;
|
||||
if (length > intDigits) {
|
||||
// decimal point needed
|
||||
++length;
|
||||
if (intDigits < 1) {
|
||||
// leading zeros, -intDigits + 1
|
||||
length += 1 - intDigits;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// trailing zeros, total length given by intDigits
|
||||
length = intDigits;
|
||||
}
|
||||
if (aValue < 0)
|
||||
++length;
|
||||
PRUint32 oldlength = aDest.Length();
|
||||
aDest.SetLength(oldlength + length); // grow the string
|
||||
nsAString::iterator dest;
|
||||
aDest.BeginWriting(dest).advance(PRInt32(oldlength));
|
||||
if (aValue < 0) {
|
||||
*dest = '-'; ++dest;
|
||||
}
|
||||
int i;
|
||||
// leading zeros
|
||||
if (intDigits < 1) {
|
||||
*dest = '0'; ++dest;
|
||||
*dest = '.'; ++dest;
|
||||
for (i = 0; i > intDigits; --i) {
|
||||
*dest = '0'; ++dest;
|
||||
}
|
||||
}
|
||||
// mantissa
|
||||
int firstlen = PR_MIN(intDigits, endp - buf);
|
||||
for (i = 0; i < firstlen; i++) {
|
||||
*dest = buf[i]; ++dest;
|
||||
}
|
||||
if (i < endp - buf) {
|
||||
if (i > 0) {
|
||||
*dest = '.'; ++dest;
|
||||
}
|
||||
for (; i < endp - buf; i++) {
|
||||
*dest = buf[i]; ++dest;
|
||||
}
|
||||
}
|
||||
// trailing zeros
|
||||
for (; i < intDigits; i++) {
|
||||
*dest = '0'; ++dest;
|
||||
}
|
||||
}
|
@ -1,114 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The MITRE Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1999
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Keith Visco <kvisco@ziplink.net> (Original Author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef MITRE_ERROROBSERVER_H
|
||||
#define MITRE_ERROROBSERVER_H
|
||||
|
||||
#include "txCore.h"
|
||||
#ifdef TX_EXE
|
||||
#include <iostream.h>
|
||||
#endif
|
||||
|
||||
/**
|
||||
* A simple interface for observing errors
|
||||
**/
|
||||
class ErrorObserver {
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Default Destructor for ErrorObserver
|
||||
**/
|
||||
virtual ~ErrorObserver() {};
|
||||
|
||||
/**
|
||||
* Notifies this Error observer of a new error aRes
|
||||
**/
|
||||
virtual void receiveError(const nsAString& errorMessage, nsresult aRes) = 0;
|
||||
|
||||
/**
|
||||
* Notifies this Error observer of a new error, with default
|
||||
* error code NS_ERROR_FAILURE
|
||||
**/
|
||||
void receiveError(const nsAString& errorMessage)
|
||||
{
|
||||
receiveError(errorMessage, NS_ERROR_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}; //-- ErrorObserver
|
||||
|
||||
#ifdef TX_EXE
|
||||
/**
|
||||
* A simple ErrorObserver which allows printing error messages to a stream
|
||||
**/
|
||||
class SimpleErrorObserver : public ErrorObserver {
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Creates a new SimpleErrorObserver.
|
||||
* All errors will be printed to the console (cout).
|
||||
**/
|
||||
SimpleErrorObserver();
|
||||
|
||||
/**
|
||||
* Creates a new SimpleErrorObserver.
|
||||
* All errors will be printed to the given ostream.
|
||||
**/
|
||||
SimpleErrorObserver(ostream& errStream);
|
||||
|
||||
virtual ~SimpleErrorObserver() {};
|
||||
|
||||
/**
|
||||
* Notifies this Error observer of a new error aRes
|
||||
**/
|
||||
void receiveError(const nsAString& errorMessage, nsresult aRes);
|
||||
|
||||
virtual void supressWarnings(MBool supress);
|
||||
|
||||
private:
|
||||
|
||||
ostream* errStream;
|
||||
MBool hideWarnings;
|
||||
}; //-- SimpleErrorObserver
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -1,426 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The MITRE Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1999
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Keith Visco <kvisco@ziplink.net> (Original Author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "List.h"
|
||||
|
||||
//----------------------------/
|
||||
//- Implementation of txList -/
|
||||
//----------------------------/
|
||||
|
||||
/**
|
||||
* Default constructor for a txList;
|
||||
**/
|
||||
|
||||
txList::txList() {
|
||||
firstItem = 0;
|
||||
lastItem = 0;
|
||||
itemCount = 0;
|
||||
} //-- txList;
|
||||
|
||||
/**
|
||||
* txList destructor, cleans up ListItems, but will not delete the Object
|
||||
* references
|
||||
*/
|
||||
txList::~txList() {
|
||||
clear();
|
||||
} //-- ~txList
|
||||
|
||||
nsresult txList::insert(int index, void* objPtr)
|
||||
{
|
||||
if (index >= itemCount) {
|
||||
return insertBefore(objPtr, 0);
|
||||
}
|
||||
// add inside the list
|
||||
ListItem* nextItem = firstItem;
|
||||
for (int i = 0; i < index; i++)
|
||||
nextItem = nextItem->nextItem;
|
||||
return insertBefore(objPtr, nextItem);
|
||||
} //-- insert
|
||||
|
||||
nsresult txList::add(void* objPtr)
|
||||
{
|
||||
return insertBefore(objPtr, 0);
|
||||
} //-- add
|
||||
|
||||
/**
|
||||
* Returns the object located at the given index. This may
|
||||
* be slow or fast depending on the implementation.
|
||||
* Note:
|
||||
* Currently this list is implemented via a linked list, so
|
||||
* this method will be slow (unless the list only has a couple
|
||||
* members) as it will need traverse the links each time
|
||||
* @return the object located at the given index
|
||||
**/
|
||||
void* txList::get(int index) {
|
||||
|
||||
if (index < 0 || index >= itemCount)
|
||||
return 0;
|
||||
|
||||
int c = 0;
|
||||
ListItem* item = firstItem;
|
||||
while ((c != index) && item) {
|
||||
item = item->nextItem;
|
||||
++c;
|
||||
}
|
||||
|
||||
if (item)
|
||||
return item->objPtr;
|
||||
return 0;
|
||||
} //-- get(int)
|
||||
|
||||
txList::ListItem* txList::getFirstItem() {
|
||||
return firstItem;
|
||||
} //-- getFirstItem
|
||||
|
||||
txList::ListItem* txList::getLastItem() {
|
||||
return lastItem;
|
||||
} //-- getLastItem
|
||||
|
||||
/**
|
||||
* Returns the number of items in this txList
|
||||
**/
|
||||
PRInt32 List::getLength() {
|
||||
return itemCount;
|
||||
} //-- getLength
|
||||
|
||||
|
||||
/**
|
||||
* Inserts the given Object pointer as the item just after refItem.
|
||||
* If refItem is a null pointer the Object will be inserted at the
|
||||
* beginning of the txList (ie, insert after nothing).
|
||||
* This method assumes refItem is a member of this list, and since this
|
||||
* is a private method, I feel that's a valid assumption
|
||||
**/
|
||||
nsresult txList::insertAfter(void* objPtr, ListItem* refItem)
|
||||
{
|
||||
//-- if refItem == null insert at front
|
||||
if (!refItem)
|
||||
return insertBefore(objPtr, firstItem);
|
||||
return insertBefore(objPtr, refItem->nextItem);
|
||||
} //-- insertAfter
|
||||
|
||||
/**
|
||||
* Inserts the given Object pointer as the item just before refItem.
|
||||
* If refItem is a null pointer the Object will be inserted at the
|
||||
* end of the txList (ie, insert before nothing).
|
||||
* This method assumes refItem is a member of this list, and since this
|
||||
* is a private method, I feel that's a valid assumption
|
||||
**/
|
||||
nsresult txList::insertBefore(void* objPtr, ListItem* refItem)
|
||||
{
|
||||
ListItem* item = new ListItem;
|
||||
NS_ENSURE_TRUE(item, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
item->objPtr = objPtr;
|
||||
item->nextItem = 0;
|
||||
item->prevItem = 0;
|
||||
|
||||
//-- if refItem == null insert at end
|
||||
if (!refItem) {
|
||||
//-- add to back of list
|
||||
if (lastItem) {
|
||||
lastItem->nextItem = item;
|
||||
item->prevItem = lastItem;
|
||||
}
|
||||
lastItem = item;
|
||||
if (!firstItem)
|
||||
firstItem = item;
|
||||
}
|
||||
else {
|
||||
//-- insert before given item
|
||||
item->nextItem = refItem;
|
||||
item->prevItem = refItem->prevItem;
|
||||
refItem->prevItem = item;
|
||||
|
||||
if (item->prevItem)
|
||||
item->prevItem->nextItem = item;
|
||||
else
|
||||
firstItem = item;
|
||||
}
|
||||
|
||||
// increase the item count
|
||||
++itemCount;
|
||||
|
||||
return NS_OK;
|
||||
} //-- insertBefore
|
||||
|
||||
void* txList::remove(void* objPtr) {
|
||||
ListItem* item = firstItem;
|
||||
while (item) {
|
||||
if (item->objPtr == objPtr) {
|
||||
remove(item);
|
||||
delete item;
|
||||
return objPtr;
|
||||
}
|
||||
item = item->nextItem;
|
||||
}
|
||||
// not in list
|
||||
return 0;
|
||||
} //-- remove
|
||||
|
||||
txList::ListItem* txList::remove(ListItem* item) {
|
||||
|
||||
if (!item)
|
||||
return item;
|
||||
|
||||
//-- adjust the previous item's next pointer
|
||||
if (item->prevItem) {
|
||||
item->prevItem->nextItem = item->nextItem;
|
||||
}
|
||||
//-- adjust the next item's previous pointer
|
||||
if (item->nextItem) {
|
||||
item->nextItem->prevItem = item->prevItem;
|
||||
}
|
||||
|
||||
//-- adjust first and last items
|
||||
if (item == firstItem)
|
||||
firstItem = item->nextItem;
|
||||
if (item == lastItem)
|
||||
lastItem = item->prevItem;
|
||||
|
||||
//-- decrease Item count
|
||||
--itemCount;
|
||||
return item;
|
||||
} //-- remove
|
||||
|
||||
void txList::clear()
|
||||
{
|
||||
ListItem* item = firstItem;
|
||||
while (item) {
|
||||
ListItem* tItem = item;
|
||||
item = item->nextItem;
|
||||
delete tItem;
|
||||
}
|
||||
firstItem = 0;
|
||||
lastItem = 0;
|
||||
itemCount = 0;
|
||||
}
|
||||
|
||||
//------------------------------------/
|
||||
//- Implementation of txListIterator -/
|
||||
//------------------------------------/
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new txListIterator for the given txList
|
||||
* @param list, the txList to create an Iterator for
|
||||
**/
|
||||
txListIterator::txListIterator(txList* list) {
|
||||
this->list = list;
|
||||
currentItem = 0;
|
||||
atEndOfList = MB_FALSE;
|
||||
} //-- txListIterator
|
||||
|
||||
txListIterator::~txListIterator() {
|
||||
//-- overrides default destructor to do nothing
|
||||
} //-- ~txListIterator
|
||||
|
||||
/**
|
||||
* Adds the Object pointer to the txList pointed to by this txListIterator.
|
||||
* The Object pointer is inserted as the next item in the txList
|
||||
* based on the current position within the txList
|
||||
* @param objPtr the Object pointer to add to the list
|
||||
**/
|
||||
nsresult txListIterator::addAfter(void* objPtr)
|
||||
{
|
||||
if (currentItem || !atEndOfList)
|
||||
return list->insertAfter(objPtr, currentItem);
|
||||
return list->insertBefore(objPtr, 0);
|
||||
|
||||
} //-- addAfter
|
||||
|
||||
/**
|
||||
* Adds the Object pointer to the txList pointed to by this txListIterator.
|
||||
* The Object pointer is inserted as the previous item in the txList
|
||||
* based on the current position within the txList
|
||||
* @param objPtr the Object pointer to add to the list
|
||||
**/
|
||||
nsresult txListIterator::addBefore(void* objPtr)
|
||||
{
|
||||
if (currentItem || atEndOfList)
|
||||
return list->insertBefore(objPtr, currentItem);
|
||||
return list->insertAfter(objPtr, 0);
|
||||
|
||||
} //-- addBefore
|
||||
|
||||
/**
|
||||
* Returns true if a sucessful call to the next() method can be made
|
||||
* @return MB_TRUE if a sucessful call to the next() method can be made,
|
||||
* otherwise MB_FALSE
|
||||
**/
|
||||
MBool txListIterator::hasNext() {
|
||||
MBool hasNext = MB_FALSE;
|
||||
if (currentItem)
|
||||
hasNext = (currentItem->nextItem != 0);
|
||||
else if (!atEndOfList)
|
||||
hasNext = (list->firstItem != 0);
|
||||
|
||||
return hasNext;
|
||||
} //-- hasNext
|
||||
|
||||
/**
|
||||
* Returns true if a sucessful call to the previous() method can be made
|
||||
* @return MB_TRUE if a sucessful call to the previous() method can be made,
|
||||
* otherwise MB_FALSE
|
||||
**/
|
||||
MBool txListIterator::hasPrevious() {
|
||||
MBool hasPrevious = MB_FALSE;
|
||||
if (currentItem)
|
||||
hasPrevious = (currentItem->prevItem != 0);
|
||||
else if (atEndOfList)
|
||||
hasPrevious = (list->lastItem != 0);
|
||||
|
||||
return hasPrevious;
|
||||
} //-- hasPrevious
|
||||
|
||||
/**
|
||||
* Returns the next Object pointer in the list
|
||||
**/
|
||||
void* txListIterator::next() {
|
||||
|
||||
void* obj = 0;
|
||||
if (currentItem)
|
||||
currentItem = currentItem->nextItem;
|
||||
else if (!atEndOfList)
|
||||
currentItem = list->firstItem;
|
||||
|
||||
if (currentItem)
|
||||
obj = currentItem->objPtr;
|
||||
else
|
||||
atEndOfList = MB_TRUE;
|
||||
|
||||
return obj;
|
||||
} //-- next
|
||||
|
||||
/**
|
||||
* Returns the previous Object in the list
|
||||
**/
|
||||
void* txListIterator::previous() {
|
||||
|
||||
void* obj = 0;
|
||||
|
||||
if (currentItem)
|
||||
currentItem = currentItem->prevItem;
|
||||
else if (atEndOfList)
|
||||
currentItem = list->lastItem;
|
||||
|
||||
if (currentItem)
|
||||
obj = currentItem->objPtr;
|
||||
|
||||
atEndOfList = MB_FALSE;
|
||||
|
||||
return obj;
|
||||
} //-- previous
|
||||
|
||||
/**
|
||||
* Returns the current Object
|
||||
**/
|
||||
void* txListIterator::current() {
|
||||
|
||||
if (currentItem)
|
||||
return currentItem->objPtr;
|
||||
|
||||
return 0;
|
||||
} //-- current
|
||||
|
||||
/**
|
||||
* Moves the specified number of steps
|
||||
**/
|
||||
void* txListIterator::advance(int i) {
|
||||
|
||||
void* obj = 0;
|
||||
|
||||
if (i > 0) {
|
||||
if (!currentItem && !atEndOfList) {
|
||||
currentItem = list->firstItem;
|
||||
--i;
|
||||
}
|
||||
for (; currentItem && i > 0; i--)
|
||||
currentItem = currentItem->nextItem;
|
||||
|
||||
atEndOfList = currentItem == 0;
|
||||
}
|
||||
else if (i < 0) {
|
||||
if (!currentItem && atEndOfList) {
|
||||
currentItem = list->lastItem;
|
||||
++i;
|
||||
}
|
||||
for (; currentItem && i < 0; i++)
|
||||
currentItem = currentItem->prevItem;
|
||||
|
||||
atEndOfList = MB_FALSE;
|
||||
}
|
||||
|
||||
if (currentItem)
|
||||
obj = currentItem->objPtr;
|
||||
|
||||
return obj;
|
||||
} //-- advance
|
||||
|
||||
/**
|
||||
* Removes the Object last returned by the next() or previous() methods;
|
||||
* @return the removed Object pointer
|
||||
**/
|
||||
void* txListIterator::remove() {
|
||||
|
||||
void* obj = 0;
|
||||
if (currentItem) {
|
||||
obj = currentItem->objPtr;
|
||||
txList::ListItem* item = currentItem;
|
||||
previous(); //-- make previous item the current item
|
||||
list->remove(item);
|
||||
delete item;
|
||||
}
|
||||
return obj;
|
||||
} //-- remove
|
||||
|
||||
/**
|
||||
* Resets the current location within the txList to the beginning of the txList
|
||||
**/
|
||||
void txListIterator::reset() {
|
||||
atEndOfList = MB_FALSE;
|
||||
currentItem = 0;
|
||||
} //-- reset
|
||||
|
||||
/**
|
||||
* Move the iterator to right after the last element
|
||||
**/
|
||||
void txListIterator::resetToEnd() {
|
||||
atEndOfList = MB_TRUE;
|
||||
currentItem = 0;
|
||||
} //-- moveToEnd
|
@ -1,224 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The MITRE Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1999
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Keith Visco <kvisco@ziplink.net> (Original Author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef TRANSFRMX_LIST_H
|
||||
#define TRANSFRMX_LIST_H
|
||||
|
||||
#include "txCore.h"
|
||||
|
||||
class txListIterator;
|
||||
|
||||
/**
|
||||
* Represents an ordered list of Object pointers. Modeled after a Java 2 List.
|
||||
**/
|
||||
class txList : public TxObject {
|
||||
|
||||
friend class txListIterator;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Creates an empty txList
|
||||
**/
|
||||
txList();
|
||||
|
||||
/**
|
||||
* txList destructor, object references will not be deleted.
|
||||
**/
|
||||
virtual ~txList();
|
||||
|
||||
/**
|
||||
* Returns the object located at the given index. This may
|
||||
* be slow or fast depending on the implementation.
|
||||
* @return the object located at the given index
|
||||
**/
|
||||
void* get(int index);
|
||||
|
||||
/**
|
||||
* Returns the number of items in this txList
|
||||
**/
|
||||
PRInt32 getLength();
|
||||
|
||||
/**
|
||||
* Adds the given Object to the specified position in the list
|
||||
**/
|
||||
nsresult insert(int index, void* objPtr);
|
||||
|
||||
/**
|
||||
* Adds the given Object to the list
|
||||
**/
|
||||
nsresult add(void* objPtr);
|
||||
|
||||
/**
|
||||
* Removes the given Object pointer from the list
|
||||
**/
|
||||
void* remove(void* objPtr);
|
||||
|
||||
/*
|
||||
* Removes all the objects from the list
|
||||
*/
|
||||
void clear();
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
struct ListItem {
|
||||
ListItem* nextItem;
|
||||
ListItem* prevItem;
|
||||
void* objPtr;
|
||||
};
|
||||
|
||||
ListItem* getFirstItem();
|
||||
ListItem* getLastItem();
|
||||
|
||||
/**
|
||||
* Removes the given ListItem pointer from the list
|
||||
**/
|
||||
ListItem* remove(ListItem* sItem);
|
||||
|
||||
private:
|
||||
txList(const txList& aOther); // not implemented
|
||||
|
||||
ListItem* firstItem;
|
||||
ListItem* lastItem;
|
||||
PRInt32 itemCount;
|
||||
|
||||
nsresult insertAfter(void* objPtr, ListItem* sItem);
|
||||
nsresult insertBefore(void* objPtr, ListItem* sItem);
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* An Iterator for the txList Class
|
||||
**/
|
||||
class txListIterator {
|
||||
|
||||
public:
|
||||
/**
|
||||
* Creates a new txListIterator for the given txList
|
||||
* @param list, the txList to create an Iterator for
|
||||
**/
|
||||
txListIterator(txList* list);
|
||||
|
||||
/**
|
||||
* Destructor, destroys a given instance of a txListIterator
|
||||
**/
|
||||
~txListIterator();
|
||||
|
||||
/**
|
||||
* Adds the Object pointer to the txList pointed to by this txListIterator.
|
||||
* The Object pointer is inserted as the next item in the txList
|
||||
* based on the current position within the txList
|
||||
* @param objPtr the Object pointer to add to the list
|
||||
**/
|
||||
nsresult addAfter(void* objPtr);
|
||||
|
||||
/**
|
||||
* Adds the Object pointer to the txList pointed to by this txListIterator.
|
||||
* The Object pointer is inserted as the previous item in the txList
|
||||
* based on the current position within the txList
|
||||
* @param objPtr the Object pointer to add to the list
|
||||
**/
|
||||
nsresult addBefore(void* objPtr);
|
||||
|
||||
/**
|
||||
* Returns true if a sucessful call to the next() method can be made
|
||||
* @return MB_TRUE if a sucessful call to the next() method can be made,
|
||||
* otherwise MB_FALSE
|
||||
**/
|
||||
MBool hasNext();
|
||||
|
||||
/**
|
||||
* Returns true if a sucessful call to the previous() method can be made
|
||||
* @return MB_TRUE if a sucessful call to the previous() method can be made,
|
||||
* otherwise MB_FALSE
|
||||
**/
|
||||
MBool hasPrevious();
|
||||
|
||||
/**
|
||||
* Returns the next Object pointer from the list
|
||||
**/
|
||||
void* next();
|
||||
|
||||
/**
|
||||
* Returns the previous Object pointer from the list
|
||||
**/
|
||||
void* previous();
|
||||
|
||||
/**
|
||||
* Returns the current Object
|
||||
**/
|
||||
void* current();
|
||||
|
||||
/**
|
||||
* Moves the specified number of steps
|
||||
**/
|
||||
void* advance(int i);
|
||||
|
||||
/**
|
||||
* Removes the Object last returned by the next() or previous() methods;
|
||||
* @return the removed Object pointer
|
||||
**/
|
||||
void* remove();
|
||||
|
||||
/**
|
||||
* Resets the current location within the txList to the beginning of the txList
|
||||
**/
|
||||
void reset();
|
||||
|
||||
/**
|
||||
* Resets the current location within the txList to the end of the txList
|
||||
**/
|
||||
void resetToEnd();
|
||||
|
||||
private:
|
||||
|
||||
//-- points to the current list item
|
||||
txList::ListItem* currentItem;
|
||||
|
||||
//-- points to the list to iterator over
|
||||
txList* list;
|
||||
|
||||
//-- we've moved off the end of the list
|
||||
MBool atEndOfList;
|
||||
};
|
||||
|
||||
typedef txList List;
|
||||
|
||||
#endif
|
@ -1,86 +0,0 @@
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is TransforMiiX XSLT processor code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Axel Hecht.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2001
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Axel Hecht <axel@pike.org>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = transformiix
|
||||
LIBRARY_NAME = txbase_s
|
||||
MOZILLA_INTERNAL_API = 1
|
||||
|
||||
REQUIRES = string \
|
||||
xpcom \
|
||||
$(NULL)
|
||||
|
||||
ifndef TX_EXE
|
||||
REQUIRES += unicharutil \
|
||||
dom \
|
||||
content \
|
||||
layout \
|
||||
widget \
|
||||
necko \
|
||||
caps \
|
||||
xpconnect \
|
||||
js \
|
||||
htmlparser \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
CPPSRCS = Double.cpp \
|
||||
List.cpp \
|
||||
txAtoms.cpp \
|
||||
txExpandedNameMap.cpp \
|
||||
txNamespaceMap.cpp \
|
||||
txURIUtils.cpp
|
||||
|
||||
ifdef TX_EXE
|
||||
CPPSRCS += SimpleErrorObserver.cpp \
|
||||
txStringUtils.cpp
|
||||
endif
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a
|
||||
# static lib.
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
INCLUDES += -I$(srcdir)/../xpath -I$(srcdir)/../xslt -I$(srcdir)/../xml \
|
||||
-I$(srcdir)/../xml/dom -I$(srcdir)
|
@ -1,80 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The MITRE Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1999
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Keith Visco <kvisco@ziplink.net> (Original Author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "ErrorObserver.h"
|
||||
#include "nsString.h"
|
||||
|
||||
/**
|
||||
* Creates a new SimpleErrorObserver.
|
||||
* All errors will be printed to the console (cout).
|
||||
**/
|
||||
SimpleErrorObserver::SimpleErrorObserver() {
|
||||
#ifdef TX_EXE
|
||||
errStream = &cout;
|
||||
#endif
|
||||
hideWarnings = MB_FALSE;
|
||||
} //-- SimpleErrorObserver
|
||||
|
||||
/**
|
||||
* Creates a new SimpleErrorObserver.
|
||||
* All errors will be printed to the given ostream.
|
||||
**/
|
||||
SimpleErrorObserver::SimpleErrorObserver(ostream& errStream) {
|
||||
this->errStream = &errStream;
|
||||
hideWarnings = MB_FALSE;
|
||||
} //-- SimpleErrorObserver
|
||||
|
||||
/**
|
||||
* Notifies this Error observer of a new error using the given error level
|
||||
**/
|
||||
void SimpleErrorObserver::receiveError(const nsAString& errorMessage,
|
||||
nsresult aRes)
|
||||
{
|
||||
#ifdef TX_EXE
|
||||
if (NS_FAILED(aRes)) {
|
||||
*errStream << "error: ";
|
||||
}
|
||||
|
||||
*errStream << NS_LossyConvertUCS2toASCII(errorMessage).get() << endl;
|
||||
errStream->flush();
|
||||
#endif
|
||||
}
|
||||
|
||||
void SimpleErrorObserver::supressWarnings(MBool supress) {
|
||||
this->hideWarnings = supress;
|
||||
} //-- supressWarnings
|
@ -1,67 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Axel Hecht.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Axel Hecht <axel@pike.org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef TxLog_h__
|
||||
#define TxLog_h__
|
||||
|
||||
#include "prlog.h"
|
||||
#include "prmem.h"
|
||||
#endif
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
class txLog
|
||||
{
|
||||
public:
|
||||
static PRLogModuleInfo *xpath;
|
||||
static PRLogModuleInfo *xslt;
|
||||
};
|
||||
|
||||
#define TX_LG_IMPL \
|
||||
PRLogModuleInfo * txLog::xpath = 0; \
|
||||
PRLogModuleInfo * txLog::xslt = 0;
|
||||
|
||||
#define TX_LG_CREATE \
|
||||
txLog::xpath = PR_NewLogModule("xpath"); \
|
||||
txLog::xslt = PR_NewLogModule("xslt")
|
||||
|
||||
#else
|
||||
|
||||
#define TX_LG_IMPL
|
||||
#define TX_LG_CREATE
|
||||
|
||||
#endif
|
@ -1,102 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Peter Van der Beken <peterv@propagandism.org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "txAtoms.h"
|
||||
#include "nsStaticAtom.h"
|
||||
#include "nsMemory.h"
|
||||
|
||||
// define storage for all atoms
|
||||
#define TX_ATOM(_name, _value) nsIAtom* txXMLAtoms::_name;
|
||||
XML_ATOMS
|
||||
#undef TX_ATOM
|
||||
|
||||
#define TX_ATOM(_name, _value) nsIAtom* txXPathAtoms::_name;
|
||||
#include "txXPathAtomList.h"
|
||||
#undef TX_ATOM
|
||||
|
||||
#define TX_ATOM(_name, _value) nsIAtom* txXSLTAtoms::_name;
|
||||
#include "txXSLTAtomList.h"
|
||||
#undef TX_ATOM
|
||||
|
||||
#define TX_ATOM(_name, _value) nsIAtom* txHTMLAtoms::_name;
|
||||
#include "txHTMLAtomList.h"
|
||||
#undef TX_ATOM
|
||||
|
||||
static const nsStaticAtom XMLAtoms_info[] = {
|
||||
#define TX_ATOM(name_, value_) { value_, &txXMLAtoms::name_ },
|
||||
XML_ATOMS
|
||||
#undef TX_ATOM
|
||||
};
|
||||
|
||||
static const nsStaticAtom XPathAtoms_info[] = {
|
||||
#define TX_ATOM(name_, value_) { value_, &txXPathAtoms::name_ },
|
||||
#include "txXPathAtomList.h"
|
||||
#undef TX_ATOM
|
||||
};
|
||||
|
||||
static const nsStaticAtom XSLTAtoms_info[] = {
|
||||
#define TX_ATOM(name_, value_) { value_, &txXSLTAtoms::name_ },
|
||||
#include "txXSLTAtomList.h"
|
||||
#undef TX_ATOM
|
||||
};
|
||||
|
||||
static const nsStaticAtom HTMLAtoms_info[] = {
|
||||
#define TX_ATOM(name_, value_) { value_, &txHTMLAtoms::name_ },
|
||||
#include "txHTMLAtomList.h"
|
||||
#undef TX_ATOM
|
||||
};
|
||||
|
||||
void txXMLAtoms::init()
|
||||
{
|
||||
NS_RegisterStaticAtoms(XMLAtoms_info, NS_ARRAY_LENGTH(XMLAtoms_info));
|
||||
}
|
||||
|
||||
void txXPathAtoms::init()
|
||||
{
|
||||
NS_RegisterStaticAtoms(XPathAtoms_info, NS_ARRAY_LENGTH(XPathAtoms_info));
|
||||
}
|
||||
|
||||
void txXSLTAtoms::init()
|
||||
{
|
||||
NS_RegisterStaticAtoms(XSLTAtoms_info, NS_ARRAY_LENGTH(XSLTAtoms_info));
|
||||
}
|
||||
|
||||
void txHTMLAtoms::init()
|
||||
{
|
||||
NS_RegisterStaticAtoms(HTMLAtoms_info, NS_ARRAY_LENGTH(HTMLAtoms_info));
|
||||
}
|
@ -1,105 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Peter Van der Beken <peterv@propagandism.org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef TRANSFRMX_ATOMS_H
|
||||
#define TRANSFRMX_ATOMS_H
|
||||
|
||||
class nsIAtom;
|
||||
|
||||
/*
|
||||
* Declare all atoms
|
||||
*
|
||||
* The atom names and values are stored in tx*AtomList.h and
|
||||
* are brought to you by the magic of C preprocessing.
|
||||
* Add new atoms to tx*AtomList.h and all support logic will
|
||||
* be auto-generated.
|
||||
*/
|
||||
|
||||
#ifdef TX_EXE
|
||||
#define DOM_ATOMS \
|
||||
TX_ATOM(comment, "#comment") \
|
||||
TX_ATOM(document, "#document") \
|
||||
TX_ATOM(text, "#text")
|
||||
#else
|
||||
#define DOM_ATOMS
|
||||
#endif
|
||||
|
||||
#define XML_ATOMS \
|
||||
TX_ATOM(_empty, "") \
|
||||
TX_ATOM(base, "base") \
|
||||
TX_ATOM(_default, "default") \
|
||||
TX_ATOM(lang, "lang") \
|
||||
TX_ATOM(preserve, "preserve") \
|
||||
TX_ATOM(space, "space") \
|
||||
TX_ATOM(xml, "xml") \
|
||||
TX_ATOM(xmlns, "xmlns") \
|
||||
DOM_ATOMS
|
||||
|
||||
#define TX_ATOM(_name, _value) static nsIAtom* _name;
|
||||
|
||||
class txXMLAtoms
|
||||
{
|
||||
public:
|
||||
static void init();
|
||||
XML_ATOMS
|
||||
};
|
||||
|
||||
class txXPathAtoms
|
||||
{
|
||||
public:
|
||||
static void init();
|
||||
#include "txXPathAtomList.h"
|
||||
};
|
||||
|
||||
class txXSLTAtoms
|
||||
{
|
||||
public:
|
||||
static void init();
|
||||
#include "txXSLTAtomList.h"
|
||||
};
|
||||
|
||||
class txHTMLAtoms
|
||||
{
|
||||
public:
|
||||
static void init();
|
||||
#include "txHTMLAtomList.h"
|
||||
};
|
||||
|
||||
#undef TX_ATOM
|
||||
|
||||
#endif
|
@ -1,110 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The MITRE Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1999
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Keith Visco <kvisco@ziplink.net> (Original Author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef __txCore_h__
|
||||
#define __txCore_h__
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsDebug.h"
|
||||
#include "prtypes.h"
|
||||
|
||||
class nsAString;
|
||||
|
||||
class txObject
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Deletes this txObject
|
||||
*/
|
||||
virtual ~txObject()
|
||||
{
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Utility class for doubles
|
||||
*/
|
||||
class txDouble
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Useful constants
|
||||
*/
|
||||
static const double NaN;
|
||||
static const double POSITIVE_INFINITY;
|
||||
static const double NEGATIVE_INFINITY;
|
||||
|
||||
/**
|
||||
* Determines whether the given double represents positive or negative
|
||||
* inifinity.
|
||||
*/
|
||||
static PRBool isInfinite(double aDbl);
|
||||
|
||||
/**
|
||||
* Determines whether the given double is NaN.
|
||||
*/
|
||||
static PRBool isNaN(double aDbl);
|
||||
|
||||
/**
|
||||
* Determines whether the given double is negative.
|
||||
*/
|
||||
static PRBool isNeg(double aDbl);
|
||||
|
||||
/**
|
||||
* Converts the value of the given double to a string, and appends
|
||||
* the result to the destination string.
|
||||
*/
|
||||
static void toString(double aValue, nsAString& aDest);
|
||||
|
||||
/**
|
||||
* Converts the given String to a double, if the string value does not
|
||||
* represent a double, NaN will be returned.
|
||||
*/
|
||||
static double toDouble(const nsAString& aStr);
|
||||
};
|
||||
|
||||
// XXX These should go away eventually.
|
||||
#define TxObject txObject
|
||||
typedef txDouble Double;
|
||||
typedef PRBool MBool;
|
||||
|
||||
#define MB_TRUE PR_TRUE
|
||||
#define MB_FALSE PR_FALSE
|
||||
// XXX
|
||||
|
||||
#endif
|
@ -1,138 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Axel Hecht.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Axel Hecht <axel@pike.org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef __TX_ERROR
|
||||
#define __TX_ERROR
|
||||
|
||||
/*
|
||||
* Error value mockup for standalone.
|
||||
* See nsError.h for details.
|
||||
*/
|
||||
|
||||
#include "nsError.h"
|
||||
|
||||
#define NS_ERROR_XPATH_INVALID_ARG NS_ERROR_INVALID_ARG
|
||||
|
||||
#define NS_XSLT_GET_NEW_HANDLER \
|
||||
NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_XSLT, 1)
|
||||
|
||||
#define NS_ERROR_XSLT_PARSE_FAILURE \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_XSLT, 1)
|
||||
|
||||
#define NS_ERROR_XPATH_PARSE_FAILURE \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_XSLT, 2)
|
||||
|
||||
#define NS_ERROR_XSLT_ALREADY_SET \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_XSLT, 3)
|
||||
|
||||
#define NS_ERROR_XSLT_EXECUTION_FAILURE \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_XSLT, 4)
|
||||
|
||||
#define NS_ERROR_XPATH_UNKNOWN_FUNCTION \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_XSLT, 5)
|
||||
|
||||
#define NS_ERROR_XSLT_BAD_RECURSION \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_XSLT, 6)
|
||||
|
||||
#define NS_ERROR_XSLT_BAD_VALUE \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_XSLT, 7)
|
||||
|
||||
#define NS_ERROR_XSLT_NODESET_EXPECTED \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_XSLT, 8)
|
||||
|
||||
#define NS_ERROR_XSLT_ABORTED \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_XSLT, 9)
|
||||
|
||||
#define NS_ERROR_XSLT_NETWORK_ERROR \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_XSLT, 10)
|
||||
|
||||
#define NS_ERROR_XSLT_WRONG_MIME_TYPE \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_XSLT, 11)
|
||||
|
||||
#define NS_ERROR_XSLT_LOAD_RECURSION \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_XSLT, 12)
|
||||
|
||||
#define NS_ERROR_XPATH_BAD_ARGUMENT_COUNT \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_XSLT, 13)
|
||||
|
||||
#define NS_ERROR_XPATH_BAD_EXTENSION_FUNCTION \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_XSLT, 14)
|
||||
|
||||
#define NS_ERROR_XPATH_PAREN_EXPECTED \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_XSLT, 15)
|
||||
|
||||
#define NS_ERROR_XPATH_INVALID_AXIS \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_XSLT, 16)
|
||||
|
||||
#define NS_ERROR_XPATH_NO_NODE_TYPE_TEST \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_XSLT, 17)
|
||||
|
||||
#define NS_ERROR_XPATH_BRACKET_EXPECTED \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_XSLT, 18)
|
||||
|
||||
#define NS_ERROR_XPATH_INVALID_VAR_NAME \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_XSLT, 19)
|
||||
|
||||
#define NS_ERROR_XPATH_UNEXPECTED_END \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_XSLT, 20)
|
||||
|
||||
#define NS_ERROR_XPATH_OPERATOR_EXPECTED \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_XSLT, 21)
|
||||
|
||||
#define NS_ERROR_XPATH_UNCLOSED_LITERAL \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_XSLT, 22)
|
||||
|
||||
#define NS_ERROR_XPATH_BAD_COLON \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_XSLT, 23)
|
||||
|
||||
#define NS_ERROR_XPATH_BAD_BANG \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_XSLT, 24)
|
||||
|
||||
#define NS_ERROR_XPATH_ILLEGAL_CHAR \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_XSLT, 25)
|
||||
|
||||
#define NS_ERROR_XPATH_BINARY_EXPECTED \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_XSLT, 26)
|
||||
|
||||
#define NS_ERROR_XSLT_LOAD_BLOCKED_ERROR \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_XSLT, 27)
|
||||
|
||||
#define NS_ERROR_XPATH_INVALID_EXPRESSION_EVALUATED \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_XSLT, 28)
|
||||
|
||||
#endif // __TX_ERROR
|
@ -1,203 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Jonas Sicking.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Jonas Sicking <sicking@bigfoot.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "txExpandedNameMap.h"
|
||||
#include "txCore.h"
|
||||
#include <string.h>
|
||||
|
||||
const int kTxExpandedNameMapAllocSize = 16;
|
||||
|
||||
txExpandedNameMap::txExpandedNameMap(MBool aOwnsValues) :
|
||||
mItems(0), mItemCount(0), mBufferCount(0), mOwnsValues(aOwnsValues)
|
||||
{
|
||||
}
|
||||
|
||||
txExpandedNameMap::~txExpandedNameMap()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an item, if an item with this key already exists an error is
|
||||
* returned
|
||||
* @param aKey key for item to add
|
||||
* @param aValue value of item to add
|
||||
* @return errorcode
|
||||
*/
|
||||
nsresult txExpandedNameMap::add(const txExpandedName& aKey, TxObject* aValue)
|
||||
{
|
||||
int i;
|
||||
// Check if there already is an item with this key
|
||||
for (i = 0; i < mItemCount; ++i) {
|
||||
if (mItems[i].mLocalName == aKey.mLocalName &&
|
||||
mItems[i].mNamespaceID == aKey.mNamespaceID) {
|
||||
return NS_ERROR_XSLT_ALREADY_SET;
|
||||
}
|
||||
}
|
||||
|
||||
// Allocate a new array if needed
|
||||
if (mBufferCount == mItemCount) {
|
||||
MapItem* newItems = new MapItem[mItemCount +
|
||||
kTxExpandedNameMapAllocSize];
|
||||
if (!newItems) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
mBufferCount += kTxExpandedNameMapAllocSize;
|
||||
memcpy(newItems, mItems, mItemCount * sizeof(MapItem));
|
||||
delete [] mItems;
|
||||
mItems = newItems;
|
||||
}
|
||||
|
||||
mItems[mItemCount].mNamespaceID = aKey.mNamespaceID;
|
||||
mItems[mItemCount].mLocalName = aKey.mLocalName;
|
||||
NS_IF_ADDREF(mItems[mItemCount].mLocalName);
|
||||
mItems[mItemCount].mValue = aValue;
|
||||
++mItemCount;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an item, if an item with this key already exists it is overwritten
|
||||
* with the new value
|
||||
* @param aKey key for item to set
|
||||
* @param aValue value of item to set
|
||||
* @return errorcode
|
||||
*/
|
||||
nsresult txExpandedNameMap::set(const txExpandedName& aKey, TxObject* aValue)
|
||||
{
|
||||
int i;
|
||||
// Check if there already is an item with this key
|
||||
for (i = 0; i < mItemCount; ++i) {
|
||||
if (mItems[i].mLocalName == aKey.mLocalName &&
|
||||
mItems[i].mNamespaceID == aKey.mNamespaceID) {
|
||||
if (mOwnsValues) {
|
||||
delete mItems[i].mValue;
|
||||
}
|
||||
mItems[i].mValue = aValue;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
// Allocate a new array if needed
|
||||
if (mBufferCount == mItemCount) {
|
||||
MapItem* newItems = new MapItem[mItemCount +
|
||||
kTxExpandedNameMapAllocSize];
|
||||
if (!newItems) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
mBufferCount += kTxExpandedNameMapAllocSize;
|
||||
memcpy(newItems, mItems, mItemCount * sizeof(MapItem));
|
||||
delete [] mItems;
|
||||
mItems = newItems;
|
||||
}
|
||||
|
||||
mItems[mItemCount].mNamespaceID = aKey.mNamespaceID;
|
||||
mItems[mItemCount].mLocalName = aKey.mLocalName;
|
||||
NS_IF_ADDREF(mItems[mItemCount].mLocalName);
|
||||
mItems[mItemCount].mValue = aValue;
|
||||
++mItemCount;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an item
|
||||
* @param aKey key for item to get
|
||||
* @return item with specified key, or null if no such item exists
|
||||
*/
|
||||
TxObject* txExpandedNameMap::get(const txExpandedName& aKey) const
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < mItemCount; ++i) {
|
||||
if (mItems[i].mLocalName == aKey.mLocalName &&
|
||||
mItems[i].mNamespaceID == aKey.mNamespaceID) {
|
||||
return mItems[i].mValue;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes an item, deleting it if the map owns the values
|
||||
* @param aKey key for item to remove
|
||||
* @return item with specified key, or null if it has been deleted
|
||||
* or no such item exists
|
||||
*/
|
||||
TxObject* txExpandedNameMap::remove(const txExpandedName& aKey)
|
||||
{
|
||||
TxObject* value = 0;
|
||||
int i;
|
||||
for (i = 0; i < mItemCount; ++i) {
|
||||
if (mItems[i].mLocalName == aKey.mLocalName &&
|
||||
mItems[i].mNamespaceID == aKey.mNamespaceID) {
|
||||
NS_IF_RELEASE(mItems[i].mLocalName);
|
||||
if (mOwnsValues) {
|
||||
delete mItems[i].mValue;
|
||||
}
|
||||
else {
|
||||
value = mItems[i].mValue;
|
||||
}
|
||||
--mItemCount;
|
||||
if (i != mItemCount) {
|
||||
memcpy(&mItems[i], &mItems[mItemCount], sizeof(MapItem));
|
||||
}
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the items
|
||||
*/
|
||||
void txExpandedNameMap::clear()
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < mItemCount; ++i) {
|
||||
NS_IF_RELEASE(mItems[i].mLocalName);
|
||||
if (mOwnsValues) {
|
||||
delete mItems[i].mValue;
|
||||
}
|
||||
}
|
||||
delete [] mItems;
|
||||
mItems = nsnull;
|
||||
mItemCount = 0;
|
||||
mBufferCount = 0;
|
||||
}
|
@ -1,137 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Jonas Sicking.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Jonas Sicking <sicking@bigfoot.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef TRANSFRMX_EXPANDEDNAMEMAP_H
|
||||
#define TRANSFRMX_EXPANDEDNAMEMAP_H
|
||||
|
||||
#include "txError.h"
|
||||
#include "XMLUtils.h"
|
||||
|
||||
class TxObject;
|
||||
|
||||
class txExpandedNameMap {
|
||||
public:
|
||||
txExpandedNameMap(MBool aOwnsValues);
|
||||
|
||||
~txExpandedNameMap();
|
||||
|
||||
/**
|
||||
* Adds an item, if an item with this key already exists an error is
|
||||
* returned
|
||||
* @param aKey key for item to add
|
||||
* @param aValue value of item to add
|
||||
* @return errorcode
|
||||
*/
|
||||
nsresult add(const txExpandedName& aKey, TxObject* aValue);
|
||||
|
||||
/**
|
||||
* Sets an item, if an item with this key already exists it is overwritten
|
||||
* with the new value
|
||||
* @param aKey key for item to set
|
||||
* @param aValue value of item to set
|
||||
* @return errorcode
|
||||
*/
|
||||
nsresult set(const txExpandedName& aKey, TxObject* aValue);
|
||||
|
||||
/**
|
||||
* Gets an item
|
||||
* @param aKey key for item to get
|
||||
* @return item with specified key, or null if no such item exists
|
||||
*/
|
||||
TxObject* get(const txExpandedName& aKey) const;
|
||||
|
||||
/**
|
||||
* Removes an item, deleting it if the map owns the values
|
||||
* @param aKey key for item to remove
|
||||
* @return item with specified key, or null if it has been deleted
|
||||
* or no such item exists
|
||||
*/
|
||||
TxObject* remove(const txExpandedName& aKey);
|
||||
|
||||
/**
|
||||
* Clears the items
|
||||
*/
|
||||
void clear();
|
||||
|
||||
class iterator {
|
||||
public:
|
||||
iterator(txExpandedNameMap& aMap) : mMap(aMap),
|
||||
mCurrentPos(-1)
|
||||
{
|
||||
}
|
||||
|
||||
MBool next()
|
||||
{
|
||||
return ++mCurrentPos < mMap.mItemCount;
|
||||
}
|
||||
|
||||
const txExpandedName key()
|
||||
{
|
||||
NS_ASSERTION(mCurrentPos >= 0 && mCurrentPos < mMap.mItemCount,
|
||||
"invalid position in txExpandedNameMap::iterator");
|
||||
return txExpandedName(mMap.mItems[mCurrentPos].mNamespaceID,
|
||||
mMap.mItems[mCurrentPos].mLocalName);
|
||||
}
|
||||
|
||||
TxObject* value()
|
||||
{
|
||||
NS_ASSERTION(mCurrentPos >= 0 && mCurrentPos < mMap.mItemCount,
|
||||
"invalid position in txExpandedNameMap::iterator");
|
||||
return mMap.mItems[mCurrentPos].mValue;
|
||||
}
|
||||
|
||||
private:
|
||||
txExpandedNameMap& mMap;
|
||||
int mCurrentPos;
|
||||
};
|
||||
|
||||
friend class iterator;
|
||||
|
||||
private:
|
||||
struct MapItem {
|
||||
PRInt32 mNamespaceID;
|
||||
nsIAtom* mLocalName;
|
||||
TxObject* mValue;
|
||||
};
|
||||
|
||||
MapItem* mItems;
|
||||
int mItemCount, mBufferCount;
|
||||
MBool mOwnsValues;
|
||||
};
|
||||
|
||||
#endif //TRANSFRMX_EXPANDEDNAMEMAP_H
|
@ -1,127 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Jonas Sicking.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Jonas Sicking <jonas@sicking.cc>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "txNamespaceMap.h"
|
||||
#include "txAtoms.h"
|
||||
#include "txXPathNode.h"
|
||||
|
||||
txNamespaceMap::txNamespaceMap()
|
||||
{
|
||||
}
|
||||
|
||||
txNamespaceMap::txNamespaceMap(const txNamespaceMap& aOther)
|
||||
: mPrefixes(aOther.mPrefixes)
|
||||
{
|
||||
mNamespaces = aOther.mNamespaces; //bah! I want a copy-constructor!
|
||||
}
|
||||
|
||||
nsresult
|
||||
txNamespaceMap::addNamespace(nsIAtom* aPrefix, const nsAString& aNamespaceURI)
|
||||
{
|
||||
nsIAtom* prefix = aPrefix == txXMLAtoms::_empty ? 0 : aPrefix;
|
||||
|
||||
PRInt32 nsId;
|
||||
if (!prefix && aNamespaceURI.IsEmpty()) {
|
||||
nsId = kNameSpaceID_None;
|
||||
}
|
||||
else {
|
||||
nsId = txNamespaceManager::getNamespaceID(aNamespaceURI);
|
||||
NS_ENSURE_FALSE(nsId == kNameSpaceID_Unknown, NS_ERROR_FAILURE);
|
||||
}
|
||||
|
||||
// Check if the mapping already exists
|
||||
PRInt32 index = mPrefixes.IndexOf(prefix);
|
||||
if (index >= 0) {
|
||||
mNamespaces.ReplaceElementAt(NS_INT32_TO_PTR(nsId), index);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// New mapping
|
||||
if (!mPrefixes.AppendObject(prefix)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
if (!mNamespaces.AppendElement(NS_INT32_TO_PTR(nsId))) {
|
||||
mPrefixes.RemoveObjectAt(mPrefixes.Count() - 1);
|
||||
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
txNamespaceMap::lookupNamespace(nsIAtom* aPrefix)
|
||||
{
|
||||
if (aPrefix == txXMLAtoms::xml) {
|
||||
return kNameSpaceID_XML;
|
||||
}
|
||||
|
||||
nsIAtom* prefix = aPrefix == txXMLAtoms::_empty ? 0 : aPrefix;
|
||||
|
||||
PRInt32 index = mPrefixes.IndexOf(prefix);
|
||||
if (index >= 0) {
|
||||
return NS_PTR_TO_INT32(mNamespaces.SafeElementAt(index));
|
||||
}
|
||||
|
||||
if (!prefix) {
|
||||
return kNameSpaceID_None;
|
||||
}
|
||||
|
||||
return kNameSpaceID_Unknown;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
txNamespaceMap::lookupNamespace(const nsAString& aPrefix)
|
||||
{
|
||||
nsCOMPtr<nsIAtom> prefix = do_GetAtom(aPrefix);
|
||||
|
||||
return lookupNamespace(prefix);
|
||||
}
|
||||
|
||||
PRInt32
|
||||
txNamespaceMap::lookupNamespaceWithDefault(const nsAString& aPrefix)
|
||||
{
|
||||
nsCOMPtr<nsIAtom> prefix = do_GetAtom(aPrefix);
|
||||
if (prefix != txXSLTAtoms::_poundDefault) {
|
||||
return lookupNamespace(prefix);
|
||||
}
|
||||
|
||||
return lookupNamespace(nsnull);
|
||||
}
|
@ -1,76 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Jonas Sicking.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Jonas Sicking <sicking@bigfoot.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef TRANSFRMX_TXNAMESPACEMAP_H
|
||||
#define TRANSFRMX_TXNAMESPACEMAP_H
|
||||
|
||||
#include "nsIAtom.h"
|
||||
#include "nsCOMArray.h"
|
||||
|
||||
class txNamespaceMap
|
||||
{
|
||||
public:
|
||||
txNamespaceMap();
|
||||
txNamespaceMap(const txNamespaceMap& aOther);
|
||||
|
||||
nsrefcnt AddRef()
|
||||
{
|
||||
return ++mRefCnt;
|
||||
}
|
||||
nsrefcnt Release()
|
||||
{
|
||||
if (--mRefCnt == 0) {
|
||||
mRefCnt = 1; //stabilize
|
||||
delete this;
|
||||
return 0;
|
||||
}
|
||||
return mRefCnt;
|
||||
}
|
||||
|
||||
nsresult addNamespace(nsIAtom* aPrefix, const nsAString& aNamespaceURI);
|
||||
PRInt32 lookupNamespace(nsIAtom* aPrefix);
|
||||
PRInt32 lookupNamespace(const nsAString& aPrefix);
|
||||
PRInt32 lookupNamespaceWithDefault(const nsAString& aPrefix);
|
||||
|
||||
private:
|
||||
nsAutoRefCnt mRefCnt;
|
||||
nsCOMArray<nsIAtom> mPrefixes;
|
||||
nsVoidArray mNamespaces;
|
||||
};
|
||||
|
||||
#endif //TRANSFRMX_TXNAMESPACEMAP_H
|
@ -1,152 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Peter Van der Beken <peterv@propagandism.org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef txStack_h___
|
||||
#define txStack_h___
|
||||
|
||||
#include "nsVoidArray.h"
|
||||
|
||||
class txStack : private nsVoidArray
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Returns the specified object from the top of this stack,
|
||||
* without removing it from the stack.
|
||||
*
|
||||
* @return a pointer to the object that is the top of this stack.
|
||||
*/
|
||||
inline void* peek()
|
||||
{
|
||||
NS_ASSERTION(!isEmpty(), "peeking at empty stack");
|
||||
return ElementAt(Count() - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the specified object to the top of this stack.
|
||||
*
|
||||
* @param obj a pointer to the object that is to be added to the
|
||||
* top of this stack.
|
||||
*/
|
||||
inline nsresult push(void* aObject)
|
||||
{
|
||||
return InsertElementAt(aObject, Count()) ? NS_OK :
|
||||
NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes and returns the specified object from the top of this
|
||||
* stack.
|
||||
*
|
||||
* @return a pointer to the object that was the top of this stack.
|
||||
*/
|
||||
inline void* pop()
|
||||
{
|
||||
NS_ASSERTION(!isEmpty(), "popping from empty stack");
|
||||
const PRInt32 count = Count() - 1;
|
||||
void* object = ElementAt(count);
|
||||
RemoveElementsAt(count, 1);
|
||||
return object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if there are no objects in the stack.
|
||||
*
|
||||
* @return true if there are no objects in the stack.
|
||||
*/
|
||||
inline PRBool isEmpty()
|
||||
{
|
||||
return (Count() <= 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of elements in the Stack.
|
||||
*
|
||||
* @return the number of elements in the Stack.
|
||||
*/
|
||||
inline PRInt32 size()
|
||||
{
|
||||
return Count();
|
||||
}
|
||||
|
||||
private:
|
||||
friend class txStackIterator;
|
||||
};
|
||||
|
||||
class txStackIterator
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Creates an iterator for the given stack.
|
||||
*
|
||||
* @param aStack the stack to create an iterator for.
|
||||
*/
|
||||
inline
|
||||
txStackIterator(txStack* aStack) : mStack(aStack),
|
||||
mPosition(0)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if there is more objects on the stack.
|
||||
*
|
||||
* @return .
|
||||
*/
|
||||
inline PRBool hasNext()
|
||||
{
|
||||
return (mPosition < mStack->Count());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the next object pointer from the stack.
|
||||
*
|
||||
* @return .
|
||||
*/
|
||||
inline void* next()
|
||||
{
|
||||
if (mPosition == mStack->Count()) {
|
||||
return nsnull;
|
||||
}
|
||||
return mStack->ElementAt(mPosition++);
|
||||
}
|
||||
|
||||
private:
|
||||
txStack* mStack;
|
||||
PRInt32 mPosition;
|
||||
};
|
||||
|
||||
#endif /* txStack_h___ */
|
@ -1,153 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Axel Hecht <axel@pike.org>
|
||||
* Peter Van der Beken <peterv@propagandism.org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "txStringUtils.h"
|
||||
#include "nsDependentString.h"
|
||||
|
||||
int
|
||||
txCaseInsensitiveStringComparator::operator()(const char_type* lhs,
|
||||
const char_type* rhs,
|
||||
PRUint32 aLength ) const
|
||||
{
|
||||
PRUnichar thisChar, otherChar;
|
||||
PRUint32 compLoop = 0;
|
||||
while (compLoop < aLength) {
|
||||
thisChar = lhs[compLoop];
|
||||
if ((thisChar >= 'A') && (thisChar <= 'Z')) {
|
||||
thisChar += 32;
|
||||
}
|
||||
otherChar = rhs[compLoop];
|
||||
if ((otherChar >= 'A') && (otherChar <= 'Z')) {
|
||||
otherChar += 32;
|
||||
}
|
||||
if (thisChar != otherChar) {
|
||||
return thisChar - otherChar;
|
||||
}
|
||||
++compLoop;
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
txCaseInsensitiveStringComparator::operator()(char_type lhs,
|
||||
char_type rhs) const
|
||||
{
|
||||
if (lhs >= 'A' && lhs <= 'Z') {
|
||||
lhs += 32;
|
||||
}
|
||||
if (rhs >= 'A' && rhs <= 'Z') {
|
||||
rhs += 32;
|
||||
}
|
||||
return lhs - rhs;
|
||||
}
|
||||
|
||||
/**
|
||||
* A character sink for case conversion.
|
||||
*/
|
||||
class ConvertToLowerCase
|
||||
{
|
||||
public:
|
||||
typedef PRUnichar value_type;
|
||||
|
||||
PRUint32 write( const PRUnichar* aSource, PRUint32 aSourceLength)
|
||||
{
|
||||
PRUnichar* cp = NS_CONST_CAST(PRUnichar*, aSource);
|
||||
const PRUnichar* end = aSource + aSourceLength;
|
||||
while (cp != end) {
|
||||
PRUnichar ch = *cp;
|
||||
if ((ch >= 'A') && (ch <= 'Z'))
|
||||
*cp = ch + ('a' - 'A');
|
||||
++cp;
|
||||
}
|
||||
return aSourceLength;
|
||||
}
|
||||
};
|
||||
|
||||
void TX_ToLowerCase(nsAString& aString)
|
||||
{
|
||||
nsAString::iterator fromBegin, fromEnd;
|
||||
ConvertToLowerCase converter;
|
||||
copy_string(aString.BeginWriting(fromBegin), aString.EndWriting(fromEnd),
|
||||
converter);
|
||||
}
|
||||
|
||||
/**
|
||||
* A character sink for copying with case conversion.
|
||||
*/
|
||||
class CopyToLowerCase
|
||||
{
|
||||
public:
|
||||
typedef PRUnichar value_type;
|
||||
|
||||
CopyToLowerCase(nsAString::iterator& aDestIter) : mIter(aDestIter)
|
||||
{
|
||||
}
|
||||
|
||||
PRUint32 write(const PRUnichar* aSource, PRUint32 aSourceLength)
|
||||
{
|
||||
PRUint32 len = PR_MIN(PRUint32(mIter.size_forward()), aSourceLength);
|
||||
PRUnichar* cp = mIter.get();
|
||||
const PRUnichar* end = aSource + len;
|
||||
while (aSource != end) {
|
||||
PRUnichar ch = *aSource;
|
||||
if ((ch >= 'A') && (ch <= 'Z'))
|
||||
*cp = ch + ('a' - 'A');
|
||||
else
|
||||
*cp = ch;
|
||||
++aSource;
|
||||
++cp;
|
||||
}
|
||||
mIter.advance(len);
|
||||
return len;
|
||||
}
|
||||
|
||||
protected:
|
||||
nsAString::iterator& mIter;
|
||||
};
|
||||
|
||||
void TX_ToLowerCase(const nsAString& aSource, nsAString& aDest)
|
||||
{
|
||||
nsAString::const_iterator fromBegin, fromEnd;
|
||||
nsAString::iterator toBegin;
|
||||
aDest.SetLength(aSource.Length());
|
||||
CopyToLowerCase converter(aDest.BeginWriting(toBegin));
|
||||
copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd),
|
||||
converter);
|
||||
}
|
@ -1,82 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Axel Hecht <axel@pike.org>
|
||||
* Peter Van der Beken <peterv@propagandism.org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef txStringUtils_h__
|
||||
#define txStringUtils_h__
|
||||
|
||||
#include "nsAString.h"
|
||||
#include "nsIAtom.h"
|
||||
|
||||
/**
|
||||
* Check equality between a string and an atom containing ASCII.
|
||||
*/
|
||||
inline PRBool
|
||||
TX_StringEqualsAtom(const nsASingleFragmentString& aString, nsIAtom* aAtom)
|
||||
{
|
||||
const char* ASCIIAtom;
|
||||
aAtom->GetUTF8String(&ASCIIAtom);
|
||||
|
||||
return aString.EqualsASCII(ASCIIAtom);
|
||||
}
|
||||
|
||||
#ifndef TX_EXE
|
||||
|
||||
#include "nsUnicharUtils.h"
|
||||
typedef nsCaseInsensitiveStringComparator txCaseInsensitiveStringComparator;
|
||||
|
||||
#define TX_ToLowerCase ToLowerCase
|
||||
|
||||
#else
|
||||
|
||||
// These only work for ASCII ranges!
|
||||
|
||||
class txCaseInsensitiveStringComparator
|
||||
: public nsStringComparator
|
||||
{
|
||||
public:
|
||||
virtual int operator()(const char_type*, const char_type*, PRUint32 aLength) const;
|
||||
virtual int operator()(char_type, char_type) const;
|
||||
};
|
||||
|
||||
void TX_ToLowerCase(nsAString& aString);
|
||||
void TX_ToLowerCase(const nsAString& aSource, nsAString& aDest);
|
||||
|
||||
#endif
|
||||
|
||||
#endif // txStringUtils_h__
|
@ -1,90 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Peter Van der Beken <peterv@propagandism.org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef txTokenizer_h___
|
||||
#define txTokenizer_h___
|
||||
|
||||
#include "nsDependentSubstring.h"
|
||||
#include "XMLUtils.h"
|
||||
|
||||
class txTokenizer
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Creates a new txTokenizer using the given source string.
|
||||
*/
|
||||
txTokenizer(const nsAFlatString& aSource)
|
||||
{
|
||||
aSource.BeginReading(mIter);
|
||||
aSource.EndReading(mEnd);
|
||||
|
||||
while (mIter != mEnd && XMLUtils::isWhitespace(*mIter)) {
|
||||
++mIter;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if any more tokens are available.
|
||||
*/
|
||||
PRBool hasMoreTokens()
|
||||
{
|
||||
return (mIter != mEnd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the next token.
|
||||
*/
|
||||
const nsDependentSubstring nextToken()
|
||||
{
|
||||
nsAFlatString::const_char_iterator begin = mIter;
|
||||
while (mIter != mEnd && !XMLUtils::isWhitespace(*mIter)) {
|
||||
++mIter;
|
||||
}
|
||||
nsAFlatString::const_char_iterator end = mIter;
|
||||
while (mIter != mEnd && XMLUtils::isWhitespace(*mIter)) {
|
||||
++mIter;
|
||||
}
|
||||
return Substring(begin, end);
|
||||
}
|
||||
|
||||
private:
|
||||
nsAFlatString::const_char_iterator mIter, mEnd;
|
||||
};
|
||||
|
||||
#endif /* txTokenizer_h___ */
|
||||
|
@ -1,352 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The MITRE Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1999
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Keith Visco <kvisco@ziplink.net> (Original Author)
|
||||
* Larry Fitzpatrick, OpenText <lef@opentext.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "txURIUtils.h"
|
||||
|
||||
#ifndef TX_EXE
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIAttribute.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsINodeInfo.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* URIUtils
|
||||
* A set of utilities for handling URIs
|
||||
**/
|
||||
|
||||
#ifdef TX_EXE
|
||||
//- Constants -/
|
||||
|
||||
const char URIUtils::HREF_PATH_SEP = '/';
|
||||
|
||||
/**
|
||||
* Implementation of utility functions for parsing URLs.
|
||||
* Just file paths for now.
|
||||
*/
|
||||
void
|
||||
txParsedURL::init(const nsAFlatString& aSpec)
|
||||
{
|
||||
mPath.Truncate();
|
||||
mName.Truncate();
|
||||
mRef.Truncate();
|
||||
PRUint32 specLength = aSpec.Length();
|
||||
if (!specLength) {
|
||||
return;
|
||||
}
|
||||
const PRUnichar* start = aSpec.get();
|
||||
const PRUnichar* end = start + specLength;
|
||||
const PRUnichar* c = end - 1;
|
||||
|
||||
// check for #ref
|
||||
for (; c >= start; --c) {
|
||||
if (*c == '#') {
|
||||
// we could eventually unescape this, too.
|
||||
mRef = Substring(c + 1, end);
|
||||
end = c;
|
||||
--c;
|
||||
if (c == start) {
|
||||
// we're done,
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (c = end - 1; c >= start; --c) {
|
||||
if (*c == '/') {
|
||||
mName = Substring(c + 1, end);
|
||||
mPath = Substring(start, c + 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
mName = Substring(start, end);
|
||||
}
|
||||
|
||||
void
|
||||
txParsedURL::resolve(const txParsedURL& aRef, txParsedURL& aDest)
|
||||
{
|
||||
/*
|
||||
* No handling of absolute URLs now.
|
||||
* These aren't really URLs yet, anyway, but paths with refs
|
||||
*/
|
||||
aDest.mPath = mPath + aRef.mPath;
|
||||
|
||||
if (aRef.mName.IsEmpty() && aRef.mPath.IsEmpty()) {
|
||||
// the relative URL is just a fragment identifier
|
||||
aDest.mName = mName;
|
||||
if (aRef.mRef.IsEmpty()) {
|
||||
// and not even that, keep the base ref
|
||||
aDest.mRef = mRef;
|
||||
return;
|
||||
}
|
||||
aDest.mRef = aRef.mRef;
|
||||
return;
|
||||
}
|
||||
aDest.mName = aRef.mName;
|
||||
aDest.mRef = aRef.mRef;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an InputStream for the file represented by the href
|
||||
* argument
|
||||
* @param href the href of the file to get the input stream for.
|
||||
* @return an InputStream to the desired resource
|
||||
* @exception java.io.FileNotFoundException when the file could not be
|
||||
* found
|
||||
**/
|
||||
istream* URIUtils::getInputStream(const nsAString& href, nsAString& errMsg)
|
||||
{
|
||||
return new ifstream(NS_LossyConvertUCS2toASCII(href).get(), ios::in);
|
||||
} //-- getInputStream
|
||||
|
||||
/**
|
||||
* Returns the document base of the href argument
|
||||
* @return the document base of the given href
|
||||
**/
|
||||
void URIUtils::getDocumentBase(const nsAFlatString& href, nsAString& dest)
|
||||
{
|
||||
if (href.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsAFlatString::const_char_iterator temp;
|
||||
href.BeginReading(temp);
|
||||
PRUint32 iter = href.Length();
|
||||
while (iter > 0) {
|
||||
if (temp[--iter] == HREF_PATH_SEP) {
|
||||
dest.Append(Substring(href, 0, iter));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Resolves the given href argument, using the given documentBase
|
||||
* if necessary.
|
||||
* The new resolved href will be appended to the given dest String
|
||||
**/
|
||||
void URIUtils::resolveHref(const nsAString& href, const nsAString& base,
|
||||
nsAString& dest) {
|
||||
if (base.IsEmpty()) {
|
||||
dest.Append(href);
|
||||
return;
|
||||
}
|
||||
if (href.IsEmpty()) {
|
||||
dest.Append(base);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef TX_EXE
|
||||
nsCOMPtr<nsIURI> pURL;
|
||||
nsAutoString resultHref;
|
||||
nsresult result = NS_NewURI(getter_AddRefs(pURL), base);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
NS_MakeAbsoluteURI(resultHref, href, pURL);
|
||||
dest.Append(resultHref);
|
||||
}
|
||||
#else
|
||||
nsAutoString documentBase;
|
||||
getDocumentBase(PromiseFlatString(base), documentBase);
|
||||
|
||||
//-- join document base + href
|
||||
if (!documentBase.IsEmpty()) {
|
||||
dest.Append(documentBase);
|
||||
if (documentBase.CharAt(documentBase.Length()-1) != HREF_PATH_SEP)
|
||||
dest.Append(PRUnichar(HREF_PATH_SEP));
|
||||
}
|
||||
dest.Append(href);
|
||||
|
||||
#endif
|
||||
} //-- resolveHref
|
||||
|
||||
#ifndef TX_EXE
|
||||
|
||||
nsIScriptSecurityManager *gTxSecurityManager = 0;
|
||||
|
||||
// static
|
||||
PRBool URIUtils::CanCallerAccess(nsIDOMNode *aNode)
|
||||
{
|
||||
if (!gTxSecurityManager) {
|
||||
// No security manager available, let any calls go through...
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPrincipal> subjectPrincipal;
|
||||
gTxSecurityManager->GetSubjectPrincipal(getter_AddRefs(subjectPrincipal));
|
||||
|
||||
if (!subjectPrincipal) {
|
||||
// we're running as system, grant access to the node.
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
// Check whether the subject principal is the system principal.
|
||||
// For performance, we will avoid calling SubjectPrincipalIsChrome()
|
||||
// since it calls GetSubjectPrincipal() which causes us to walk
|
||||
// the JS frame stack. We already did that above, so just get the
|
||||
// system principal from the security manager, and do a raw comparison.
|
||||
nsCOMPtr<nsIPrincipal> systemPrincipal;
|
||||
gTxSecurityManager->GetSystemPrincipal(getter_AddRefs(systemPrincipal));
|
||||
|
||||
if (subjectPrincipal == systemPrincipal) {
|
||||
// we're running as system, grant access to the node.
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
// Ask the securitymanager if we have "UniversalBrowserRead"
|
||||
PRBool caps = PR_FALSE;
|
||||
nsresult rv =
|
||||
gTxSecurityManager->IsCapabilityEnabled("UniversalBrowserRead",
|
||||
&caps);
|
||||
NS_ENSURE_SUCCESS(rv, PR_FALSE);
|
||||
if (caps) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
// Make sure that this is a real node. We do this by first QI'ing to
|
||||
// nsIContent (which is important performance wise) and if that QI
|
||||
// fails we QI to nsIDocument. If both those QI's fail we won't let
|
||||
// the caller access this unknown node.
|
||||
nsIPrincipal *principal = nsnull;
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
|
||||
nsCOMPtr<nsIAttribute> attr;
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
|
||||
if (!content) {
|
||||
doc = do_QueryInterface(aNode);
|
||||
|
||||
if (!doc) {
|
||||
attr = do_QueryInterface(aNode);
|
||||
if (!attr) {
|
||||
// aNode is not a nsIContent, a nsIAttribute or a nsIDocument,
|
||||
// something weird is going on...
|
||||
|
||||
NS_ERROR("aNode is not a nsIContent, a nsIAttribute or a nsIDocument!");
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!doc) {
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
aNode->GetOwnerDocument(getter_AddRefs(domDoc));
|
||||
if (!domDoc) {
|
||||
nsINodeInfo *ni = content ? content->NodeInfo() : attr->NodeInfo();
|
||||
|
||||
principal = ni->GetDocumentPrincipal();
|
||||
if (!principal) {
|
||||
// we can't get to the principal so we'll give up and give the
|
||||
// caller access
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
doc = do_QueryInterface(domDoc);
|
||||
NS_ASSERTION(doc, "QI to nsIDocument failed");
|
||||
}
|
||||
}
|
||||
|
||||
if (!principal) {
|
||||
principal = doc->GetPrincipal();
|
||||
}
|
||||
|
||||
if (!principal) {
|
||||
// We can't get hold of the principal for this node. This should happen
|
||||
// very rarely, like for textnodes out of the tree and <option>s created
|
||||
// using 'new Option'.
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
rv = gTxSecurityManager->CheckSameOriginPrincipal(subjectPrincipal,
|
||||
principal);
|
||||
|
||||
return NS_SUCCEEDED(rv);
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
URIUtils::ResetWithSource(nsIDocument *aNewDoc, nsIDOMNode *aSourceNode)
|
||||
{
|
||||
if (!aSourceNode) {
|
||||
aNewDoc->Reset(nsnull, nsnull);
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocument> sourceDoc = do_QueryInterface(aSourceNode);
|
||||
if (!sourceDoc) {
|
||||
nsCOMPtr<nsIDOMDocument> sourceDOMDocument;
|
||||
aSourceNode->GetOwnerDocument(getter_AddRefs(sourceDOMDocument));
|
||||
sourceDoc = do_QueryInterface(sourceDOMDocument);
|
||||
}
|
||||
if (!sourceDoc) {
|
||||
NS_ASSERTION(0, "no source document found");
|
||||
aNewDoc->Reset(nsnull, nsnull);
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
nsCOMPtr<nsILoadGroup> loadGroup = sourceDoc->GetDocumentLoadGroup();
|
||||
nsCOMPtr<nsIIOService> serv = do_GetService(NS_IOSERVICE_CONTRACTID);
|
||||
if (serv) {
|
||||
// Create a temporary channel to get nsIDocument->Reset to
|
||||
// do the right thing. We want the output document to get
|
||||
// much of the input document's characteristics.
|
||||
serv->NewChannelFromURI(sourceDoc->GetDocumentURI(),
|
||||
getter_AddRefs(channel));
|
||||
}
|
||||
aNewDoc->Reset(channel, loadGroup);
|
||||
aNewDoc->SetBaseURI(sourceDoc->GetBaseURI());
|
||||
|
||||
// Copy charset
|
||||
aNewDoc->SetDocumentCharacterSet(sourceDoc->GetDocumentCharacterSet());
|
||||
aNewDoc->SetDocumentCharacterSetSource(
|
||||
sourceDoc->GetDocumentCharacterSetSource());
|
||||
}
|
||||
|
||||
#endif /* TX_EXE */
|
@ -1,115 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The MITRE Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1999
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef TRANSFRMX_URIUTILS_H
|
||||
#define TRANSFRMX_URIUTILS_H
|
||||
|
||||
#include "txCore.h"
|
||||
#ifdef TX_EXE
|
||||
#include <fstream.h>
|
||||
#include <iostream.h>
|
||||
#include "nsString.h"
|
||||
#else
|
||||
class nsIDocument;
|
||||
class nsIDOMNode;
|
||||
class nsIScriptSecurityManager;
|
||||
extern nsIScriptSecurityManager *gTxSecurityManager;
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* A utility class for URI handling
|
||||
* Not yet finished, only handles file URI at this point
|
||||
**/
|
||||
|
||||
#ifdef TX_EXE
|
||||
class txParsedURL
|
||||
{
|
||||
public:
|
||||
void init(const nsAFlatString& aSpec);
|
||||
void resolve(const txParsedURL& aRef, txParsedURL& aDest);
|
||||
void getFile(nsString& aResult) const
|
||||
{
|
||||
aResult = mPath + mName;
|
||||
}
|
||||
nsString mPath, mName, mRef;
|
||||
};
|
||||
#endif
|
||||
|
||||
class URIUtils {
|
||||
public:
|
||||
|
||||
#ifdef TX_EXE
|
||||
/**
|
||||
* the path separator for an URI
|
||||
**/
|
||||
static const char HREF_PATH_SEP;
|
||||
|
||||
static istream* getInputStream
|
||||
(const nsAString& href, nsAString& errMsg);
|
||||
|
||||
/**
|
||||
* Returns the document base of the href argument
|
||||
* The document base will be appended to the given dest String
|
||||
**/
|
||||
static void getDocumentBase(const nsAFlatString& href, nsAString& dest);
|
||||
|
||||
#else /* TX_EXE */
|
||||
|
||||
/*
|
||||
* Checks if a caller is allowed to access a given node
|
||||
*/
|
||||
static PRBool CanCallerAccess(nsIDOMNode *aNode);
|
||||
|
||||
/**
|
||||
* Reset the given document with the document of the source node
|
||||
*/
|
||||
static void ResetWithSource(nsIDocument *aNewDoc, nsIDOMNode *aSourceNode);
|
||||
|
||||
#endif /* TX_EXE */
|
||||
|
||||
/**
|
||||
* Resolves the given href argument, using the given documentBase
|
||||
* if necessary.
|
||||
* The new resolved href will be appended to the given dest String
|
||||
**/
|
||||
static void resolveHref(const nsAString& href, const nsAString& base,
|
||||
nsAString& dest);
|
||||
}; //-- URIUtils
|
||||
|
||||
/* */
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
@ -1,12 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet type="text/xsl" href="functions.xsl"?>
|
||||
<!-- this is a test document -->
|
||||
<document>
|
||||
<!-- test comment -->
|
||||
<x name="x">x</x>
|
||||
<y name="y">y</y>
|
||||
<z name="z">z</z>
|
||||
<names xmlns:abc="foo">
|
||||
<abc:test-name/>
|
||||
</names>
|
||||
</document>
|
File diff suppressed because it is too large
Load Diff
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet type="text/xsl" href="identity.xsl"?>
|
||||
<document>
|
||||
|
||||
<x name="x">x</x>
|
||||
<y name="y">y</y>
|
||||
<z name="z">z</z>
|
||||
</document>
|
@ -1,9 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet type="text/xsl" href="identity.xsl"?>
|
||||
<!-- this is a test document -->
|
||||
<document>
|
||||
<!-- test comment -->
|
||||
<x name="x">x</x>
|
||||
<y name="y">y</y>
|
||||
<z name="z">z</z>
|
||||
</document>
|
@ -1,59 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla Public License Version
|
||||
- 1.1 (the "License"); you may not use this file except in compliance with
|
||||
- the License. You may obtain a copy of the License at
|
||||
- http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS IS" basis,
|
||||
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
- for the specific language governing rights and limitations under the
|
||||
- License.
|
||||
-
|
||||
- The Original Code is MITRE's XSL processor.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- The MITRE Corporation.
|
||||
- Portions created by the Initial Developer are Copyright (C) 1999
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<!--
|
||||
/**
|
||||
* This is a test stylesheet used for testing MITRE's XSL processor
|
||||
**/
|
||||
-->
|
||||
<xsl:stylesheet
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
version="1.0">
|
||||
|
||||
<!-- root rule -->
|
||||
<xsl:template match="/">
|
||||
<xsl:apply-templates select="node()"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="@* | node()">
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="@* | node()"/>
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
@ -1,53 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla Public License Version
|
||||
- 1.1 (the "License"); you may not use this file except in compliance with
|
||||
- the License. You may obtain a copy of the License at
|
||||
- http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS IS" basis,
|
||||
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
- for the specific language governing rights and limitations under the
|
||||
- License.
|
||||
-
|
||||
- The Original Code is mozilla.org code.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- The MITRE Corporation.
|
||||
- Portions created by the Initial Developer are Copyright (C) 1999
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
<!--
|
||||
/**
|
||||
* This is a test stylesheet used for testing MITRE's XSL processor
|
||||
**/
|
||||
-->
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
||||
|
||||
<!-- match document element -->
|
||||
<xsl:template match="document">
|
||||
This rule comes from an included xsl:stylesheet!
|
||||
<BR/>
|
||||
<B>
|
||||
<xsl:apply-templates/>
|
||||
</B>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
@ -1,12 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>TransforMiiX include test</TITLE>
|
||||
</HEAD>
|
||||
<BODY>This rule comes from an included xsl:stylesheet!<BR>
|
||||
<B>
|
||||
This is a simple test document for TransforMiiX.
|
||||
</B>
|
||||
</BODY>
|
||||
</HTML>
|
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet type="text/xsl" href="include.xsl"?>
|
||||
<!-- this is a test document -->
|
||||
<document>
|
||||
This is a simple test document for TransforMiiX.
|
||||
</document>
|
@ -1,64 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla Public License Version
|
||||
- 1.1 (the "License"); you may not use this file except in compliance with
|
||||
- the License. You may obtain a copy of the License at
|
||||
- http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS IS" basis,
|
||||
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
- for the specific language governing rights and limitations under the
|
||||
- License.
|
||||
-
|
||||
- The Original Code is MITRE's XSL processor.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- The MITRE Corporation.
|
||||
- Portions created by the Initial Developer are Copyright (C) 1998-1999
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<!--
|
||||
/**
|
||||
* This is a test stylesheet used for testing MITRE's XSL processor
|
||||
**/
|
||||
-->
|
||||
<xsl:stylesheet
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
indent-result="yes"
|
||||
result-ns="http://www.w3.org/1999/xhtml"
|
||||
version="1.0">
|
||||
|
||||
<xsl:include href="include-helper.xsl"/>
|
||||
|
||||
<!-- root rule -->
|
||||
<xsl:template match="/">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>TransforMiiX include test</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<xsl:apply-templates/>
|
||||
</BODY>
|
||||
</HTML>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
@ -1,55 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>A simple sorting example</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<P ALIGN="CENTER">
|
||||
<B>
|
||||
<FONT SIZE="+2">A simple sorting example</FONT>
|
||||
<HR SIZE="1">
|
||||
</B>
|
||||
</P>
|
||||
<TABLE BORDER="0">
|
||||
<TR>
|
||||
<TD>Sorting in ascending order</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<OL>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<LI>Dream Theatre</LI>
|
||||
<LI>Gilbert, Paul</LI>
|
||||
<LI>Royal Hunt</LI>
|
||||
<LI>Satriani, Joe</LI>
|
||||
</OL>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>Sorting in descending order</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<OL>
|
||||
<LI>Satriani, Joe</LI>
|
||||
<LI>Royal Hunt</LI>
|
||||
<LI>Gilbert, Paul</LI>
|
||||
<LI>Dream Theatre</LI>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</OL>
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</BODY>
|
||||
</HTML>
|
@ -1,14 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="sort.xsl" type="text/xsl"?>
|
||||
<!--
|
||||
This is a sample XML document supplied with TransforMiiX
|
||||
author: Keith Visco, kvisc@ziplink.net
|
||||
-->
|
||||
<sort>
|
||||
|
||||
<entry>Satriani, Joe</entry>
|
||||
<entry>Dream Theatre</entry>
|
||||
<entry>Royal Hunt</entry>
|
||||
<entry>Gilbert, Paul</entry>
|
||||
|
||||
</sort>
|
@ -1,60 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<xsl:stylesheet
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
||||
|
||||
<!-- for read-ability use HTML output and enable indenting -->
|
||||
<xsl:output method="html" indent="yes"/>
|
||||
|
||||
<!-- matches document node -->
|
||||
<xsl:template match="/">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>A simple sorting example</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<P ALIGN="CENTER">
|
||||
<B>
|
||||
<FONT SIZE="+2">A simple sorting example</FONT>
|
||||
<HR SIZE="1"/>
|
||||
</B>
|
||||
</P>
|
||||
<!-- select and apply templates to remaining document -->
|
||||
<xsl:apply-templates/>
|
||||
</BODY>
|
||||
</HTML>
|
||||
</xsl:template>
|
||||
|
||||
<!-- matches root element -->
|
||||
<xsl:template match="/*">
|
||||
<TABLE BORDER="0">
|
||||
<TR><TD>Sorting in ascending order</TD></TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<OL>
|
||||
<xsl:apply-templates>
|
||||
<!-- sort using the value of the selected node -->
|
||||
<xsl:sort select="."/>
|
||||
</xsl:apply-templates>
|
||||
</OL>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR><TD>Sorting in descending order</TD></TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<OL>
|
||||
<xsl:apply-templates>
|
||||
<!-- sort using the value of the selected node -->
|
||||
<xsl:sort select="." order="descending"/>
|
||||
</xsl:apply-templates>
|
||||
</OL>
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</xsl:template>
|
||||
|
||||
<!-- matches only entry elements -->
|
||||
<xsl:template match="entry">
|
||||
<LI><xsl:apply-templates/></LI>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
@ -1,746 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<?foo this is a test processing instruction?>
|
||||
<!-- TransforMiiX Test cases, written by Keith Visco. -->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>TransforMiiX Test Cases</TITLE>
|
||||
<SCRIPT Language="JavaScript">
|
||||
|
||||
// This is a test for properly printing SCRIPT elements
|
||||
// currently there is a bug, so use xsl:text as a wrapper as I
|
||||
// have done here
|
||||
function foo() {
|
||||
var x = 1;
|
||||
var y = 2;
|
||||
return (x < y);
|
||||
}
|
||||
//
|
||||
|
||||
</SCRIPT>
|
||||
</HEAD>
|
||||
<BODY BGColor="#FFFFFF" Text="#000000">
|
||||
<CENTER>
|
||||
<FONT COLOR="BLUE" FACE="Arial" SIZE="+1">
|
||||
<B>Mozilla XSLT</B>
|
||||
</FONT>
|
||||
<BR>
|
||||
<B>Transfor<FONT COLOR="blue">Mii</FONT>X Test Cases</B>
|
||||
</CENTER>
|
||||
<P>This document serves to test basic XSL expressions.</P>
|
||||
<P>
|
||||
<B>Testing xsl:variable and xsl:copy-of</B>
|
||||
<BR>
|
||||
<B>Test:</B><xsl:copy-of select="$product-name"/><BR>
|
||||
<B>Desired Result:</B>Transfor<FONT COLOR="blue">Mii</FONT>X<BR>
|
||||
<B>Result:</B>Transfor<FONT COLOR="blue">Mii</FONT>X</P>
|
||||
<P>
|
||||
<B>Testing xsl:if</B>
|
||||
<BR>
|
||||
<B>Test:</B><xsl:if test="x | y | z">true</xsl:if><BR>
|
||||
<B>Desired Result:</B>true<BR>
|
||||
<B>Result:</B>true</P>
|
||||
<P>
|
||||
<B>Testing xsl:if</B>
|
||||
<BR>
|
||||
<B>Test:</B><xsl:if test="true()">true</xsl:if><BR>
|
||||
<B>Desired Result:</B>true<BR>
|
||||
<B>Result:</B>true</P>
|
||||
<P>
|
||||
<B>Testing xsl:if</B>
|
||||
<BR>
|
||||
<B>Test:</B><xsl:if test="'a'='b'">a equals b</xsl:if><BR>
|
||||
<B></B><xsl:if test="'a'!='b'">a does not equal b</xsl:if><BR>
|
||||
<B>Desired Result:</B>a does not equal to b<BR>
|
||||
<B>Result:</B>a does not equal b</P>
|
||||
<P>
|
||||
<B>Testing xsl:if</B>
|
||||
<BR>
|
||||
<B>Test:</B><xsl:if test="2+1-3">2+1-3 is true</xsl:if><BR>
|
||||
<B> </B><xsl:if test="not(2+1-3)">not(2+1-3) is true</xsl:if><BR>
|
||||
<B>Desired Result:</B>not(2+1-3) is true<BR>
|
||||
<B>Result:</B>not(2+1-3) is true</P>
|
||||
<P>
|
||||
<B>Testing xsl:choose</B>
|
||||
<BR>
|
||||
<B>Test:</B>see source<BR>
|
||||
<B>Desired Result:</B>true<BR>
|
||||
<B>Result:</B>true</P>
|
||||
<P>
|
||||
<B>Testing parent and ancestor ops</B>
|
||||
<BR>
|
||||
<B>Test:</B>see source<BR>
|
||||
<B>Desired Result:</B>true<BR>
|
||||
<B>Result:</B>true<BR>
|
||||
</P>
|
||||
<P>
|
||||
<B>Testing basic xsl:apply-templates</B>
|
||||
<BR>
|
||||
<B>Test:</B><xsl:apply-templates/><BR>
|
||||
<B>Desired Result:</B>element x, element y, element z<BR>
|
||||
<B>Result:</B>
|
||||
|
||||
,element<B> x</B>
|
||||
,element<B> y</B>
|
||||
,element<B> z</B>
|
||||
|
||||
|
||||
</P>
|
||||
<P>
|
||||
<B>Testing basic xsl:apply-templates with mode</B>
|
||||
<BR>
|
||||
<B>Test:</B><xsl:apply-templates mode="mode-test"/><BR>
|
||||
<B>Desired Result:</B>x, y, z<BR>
|
||||
<B>Result:</B>, x, y, z</P>
|
||||
<P>
|
||||
<B>Testing predicates</B>
|
||||
<BR>
|
||||
<B>Test:</B>see source<BR>
|
||||
<B>Desired Result:</B>
|
||||
<B>z</B>
|
||||
<BR>
|
||||
<B>Result:</B>
|
||||
<B>z</B>
|
||||
</P>
|
||||
<P>
|
||||
<B>Testing predicates</B>
|
||||
<BR>
|
||||
<B>Test:</B>see source<BR>
|
||||
<B>Desired Result:</B>
|
||||
<BR>
|
||||
<B>Result:</B>
|
||||
</P>
|
||||
<P>
|
||||
<B>Named Template/Call Template</B>
|
||||
<P>
|
||||
<B>Test:</B><xsl:call-template name="named-template-test"/><BR>
|
||||
<B>Desired Result:</B>named template processed with default value!<BR>
|
||||
<B>Result:</B>named template processed with default value!</P>
|
||||
<P>
|
||||
<B>Test:</B>- passing arguments to named templates (see xsl source)<BR>
|
||||
<B>Desired Result:</B>named template processed with passed value!<BR>
|
||||
<B>Result:</B>named template processed with passed value!</P>
|
||||
</P>
|
||||
<P>
|
||||
<B>Attribute Value Templates and variables</B>
|
||||
<BR>
|
||||
<B>Test:</B>
|
||||
<UL><xsl:variable name="color">red</xsl:variable><BR><FONT COLOR="{$color}">Red Text</FONT></UL>
|
||||
<B>Desired Result:</B>
|
||||
<FONT COLOR="red">Red Text</FONT>
|
||||
<BR>
|
||||
<B>Result:</B>
|
||||
<FONT COLOR="red">Red Text</FONT>
|
||||
</P>
|
||||
<HR>
|
||||
<TABLE>
|
||||
<TR BGColor="#E0E0FF">
|
||||
<TD Colspan="2" ALIGN="CENTER">
|
||||
<B>Axis Identifiers (these should work, I need more test cases though)</B>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP">
|
||||
<B>Test:</B>
|
||||
</TD>
|
||||
<TD><xsl:if test="descendant::z">true</xsl:if><BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Desired Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">true</FONT>
|
||||
<BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">true</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP">
|
||||
<B>Test:</B>
|
||||
</TD>
|
||||
<TD><xsl:if test="not(descendant-or-self::no-element)">true</xsl:if><BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Desired Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">true</FONT>
|
||||
<BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">true</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<HR>
|
||||
<TABLE>
|
||||
<TR BGColor="#E0E0FF">
|
||||
<TD Colspan="2" ALIGN="CENTER">
|
||||
<B>Creating Elements with xsl:element and xsl:attribute</B>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP">
|
||||
<B>Test:</B>
|
||||
</TD>
|
||||
<TD><xsl:element name="FONT"><BR><xsl:attribute name="COLOR">blue</xsl:attribute><BR>Passed<BR></xsl:element></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Desired Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">Passed</FONT>
|
||||
<BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">Passed</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR BGCOLOR="#E0E0FF" ALIGN="CENTER">
|
||||
<TD COLSPAN="2">
|
||||
<B>Using Attribute Sets</B>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP">
|
||||
<B>Test:</B>
|
||||
</TD>
|
||||
<TD><FONT xsl:use-attribute-sets="style1"><BR>Passed<BR></FONT></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Desired Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">Passed</FONT>
|
||||
<BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue" SIZE="+0">Passed</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP">
|
||||
<B>Test:</B>
|
||||
</TD>
|
||||
<TD><xsl:element name="FONT" use-attribute-sets="style1 style2"><BR>Passed<BR></xsl:element></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Desired Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="red">Passed</FONT>
|
||||
<BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="red" SIZE="+0">Passed</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<HR>
|
||||
<TABLE>
|
||||
<TR BGColor="#E0E0FF">
|
||||
<TD Colspan="2" ALIGN="CENTER">
|
||||
<B>Numbering (only simple numbering currently implemented)</B>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP">
|
||||
<B>Test:</B>
|
||||
</TD>
|
||||
<TD><xsl:number value="4"/><BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Desired Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">4</FONT>
|
||||
<BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">4</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP">
|
||||
<B>Test:</B>
|
||||
</TD>
|
||||
<TD>see source<BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Desired Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">1. x<BR>1. y<BR>1. z</FONT>
|
||||
<BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">1. x<BR>1. y<BR>1. z<BR>
|
||||
</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<HR>
|
||||
<TABLE>
|
||||
<TR BGColor="#E0E0FF">
|
||||
<TD Colspan="2" ALIGN="CENTER">
|
||||
<B>Additive Expressions</B>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP">
|
||||
<B>Test:</B>
|
||||
</TD>
|
||||
<TD><xsl:value-of select="70+4"/><BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Desired Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">74</FONT>
|
||||
<BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">74</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP">
|
||||
<B>Test:</B>
|
||||
</TD>
|
||||
<TD><xsl:value-of select="-70+4"/><BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Desired Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">-66</FONT>
|
||||
<BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">-66</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP">
|
||||
<B>Test:</B>
|
||||
</TD>
|
||||
<TD><xsl:value-of select="1900+70+8-4"/><BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Desired Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">1974</FONT>
|
||||
<BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">1974</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP">
|
||||
<B>Test:</B>
|
||||
</TD>
|
||||
<TD><xsl:value-of select="(4+5)-(9+9)"/><BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Desired Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">-9</FONT>
|
||||
<BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">-9</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<HR>
|
||||
<TABLE>
|
||||
<TR BGColor="#E0E0FF">
|
||||
<TD Colspan="2" ALIGN="CENTER">
|
||||
<B>Multiplicative Expressions</B>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP">
|
||||
<B>Test:</B>
|
||||
</TD>
|
||||
<TD><xsl:value-of select="7*4"/><BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Desired Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">28</FONT>
|
||||
<BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">28</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP">
|
||||
<B>Test:</B>
|
||||
</TD>
|
||||
<TD><xsl:value-of select="7mod4"/><BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Desired Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">3</FONT>
|
||||
<BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">3</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP">
|
||||
<B>Test:</B>
|
||||
</TD>
|
||||
<TD><xsl:value-of select="7div4"/><BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Desired Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">1.75</FONT>
|
||||
<BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">1.75</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP">
|
||||
<B>Test:</B>
|
||||
</TD>
|
||||
<TD><xsl:value-of select="7div0"/><BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Desired Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">Infinity</FONT>
|
||||
<BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">Infinity</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP">
|
||||
<B>Test:</B>
|
||||
</TD>
|
||||
<TD><xsl:value-of select="0 div 0"/><BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Desired Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">NaN</FONT>
|
||||
<BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">NaN</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP">
|
||||
<B>Test:</B>
|
||||
</TD>
|
||||
<TD><xsl:variable name="x" select="7*3"/><BR><xsl:variable name="y" select="3"/><BR><xsl:value-of select="$x div $y"/><BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Desired Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">7</FONT>
|
||||
<BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">7<BR>
|
||||
</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<TABLE>
|
||||
<TR BGColor="#E0E0FF">
|
||||
<TD Colspan="2" ALIGN="CENTER">
|
||||
<B>Precedence tests</B>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP">
|
||||
<B>Test:</B>
|
||||
</TD>
|
||||
<TD><xsl:value-of select="2 mod 2 = 0"/><BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Desired Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">true</FONT>
|
||||
<BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">true</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP">
|
||||
<B>Test:</B>
|
||||
</TD>
|
||||
<TD><xsl:value-of select="5 mod 2<5 and 2*6>= 12"/><BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Desired Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">true</FONT>
|
||||
<BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">true</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP">
|
||||
<B>Test:</B>
|
||||
</TD>
|
||||
<TD><xsl:value-of select="5 mod 2<5 and 2*6>12"/><BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Desired Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">false</FONT>
|
||||
<BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">false</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP">
|
||||
<B>Test:</B>
|
||||
</TD>
|
||||
<TD><xsl:value-of select="4+5*3"/><BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Desired Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">19</FONT>
|
||||
<BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">19</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP">
|
||||
<B>Test:</B>
|
||||
</TD>
|
||||
<TD><xsl:value-of select="4+5*3+(6-4)*7"/><BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Desired Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">33</FONT>
|
||||
<BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">33</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<TABLE>
|
||||
<TR BGColor="#E0E0FF">
|
||||
<TD Colspan="2" ALIGN="CENTER">
|
||||
<B>Automatic Result Type Conversion</B>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP">
|
||||
<B>Test:</B>
|
||||
</TD>
|
||||
<TD><xsl:value-of select="'747' + 8"/><BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Desired Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">755</FONT>
|
||||
<BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>
|
||||
<B>Result:</B>
|
||||
</TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">755</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</BODY>
|
||||
</HTML>
|
@ -1,13 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet type="text/xsl" href="test.xsl"?>
|
||||
<!-- this is a test document -->
|
||||
<document>
|
||||
<!-- test comment -->
|
||||
<x name="x">x</x>
|
||||
<y name="y">y</y>
|
||||
<z name="z">z</z>
|
||||
|
||||
<abc>
|
||||
<def>def</def>
|
||||
</abc>
|
||||
</document>
|
@ -1,859 +0,0 @@
|
||||
<?xml version="1.0"?><!-- -*- Mode: xml; tab-width: 2; indent-tabs-mode: nil -*- -->
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla Public License Version
|
||||
- 1.1 (the "License"); you may not use this file except in compliance with
|
||||
- the License. You may obtain a copy of the License at
|
||||
- http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS IS" basis,
|
||||
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
- for the specific language governing rights and limitations under the
|
||||
- License.
|
||||
-
|
||||
- The Original Code is TransforMiiX XSLT processor code.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- Keith Visco.
|
||||
- Portions created by the Initial Developer are Copyright (C) 1999
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
- Keith Visco <kvisco@ziplink.net> (Original Author)
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<!--
|
||||
This is a test stylesheet used for testing the XSL processor
|
||||
-->
|
||||
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
||||
|
||||
<!-- set the output properties -->
|
||||
<xsl:output method="html"/>
|
||||
|
||||
<!-- AttributeSet -->
|
||||
<xsl:attribute-set name="style1">
|
||||
<xsl:attribute name="COLOR">blue</xsl:attribute>
|
||||
<xsl:attribute name="SIZE">+0</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:attribute-set name="style2">
|
||||
<xsl:attribute name="COLOR">red</xsl:attribute>
|
||||
<xsl:attribute name="SIZE">+0</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!-- root rule -->
|
||||
<xsl:template match="/">
|
||||
<xsl:processing-instruction name="foo">
|
||||
this is a test processing instruction
|
||||
</xsl:processing-instruction>
|
||||
<xsl:comment>TransforMiiX Test cases, written by Keith Visco.</xsl:comment>
|
||||
<xsl:apply-templates/>
|
||||
</xsl:template>
|
||||
|
||||
<!-- named template -->
|
||||
<xsl:template name="named-template-test">
|
||||
<xsl:param name="my-param" select="'default value'"/>
|
||||
named template processed with <xsl:text> </xsl:text>
|
||||
<xsl:value-of select="$my-param"/>!
|
||||
<xsl:if test="$dummy-param">
|
||||
<BR/>
|
||||
<FONT COLOR="red">
|
||||
Error, undeclared parameters should be ignored!
|
||||
</FONT>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<!-- empty variable for named template test -->
|
||||
<xsl:variable name="dummy-param" />
|
||||
|
||||
<!-- supress non-selected nodes-->
|
||||
<xsl:template match="*"/>
|
||||
|
||||
<!-- variable tests -->
|
||||
<xsl:variable name="product-name">
|
||||
Transfor<FONT COLOR="blue">Mii</FONT>X
|
||||
</xsl:variable>
|
||||
<!-- main rule for document element -->
|
||||
<xsl:template match="document">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>TransforMiiX Test Cases</TITLE>
|
||||
<SCRIPT Language="JavaScript">
|
||||
// This is a test for properly printing SCRIPT elements
|
||||
function foo() {
|
||||
var x = 1;
|
||||
var y = 2;
|
||||
return (x < y);
|
||||
}
|
||||
//
|
||||
</SCRIPT>
|
||||
</HEAD>
|
||||
<BODY BGColor="#FFFFFF" Text="#000000">
|
||||
<CENTER>
|
||||
<FONT COLOR="BLUE" FACE="Arial" SIZE="+1">
|
||||
<B>Mozilla XSLT</B>
|
||||
</FONT>
|
||||
<BR/>
|
||||
<B>Transfor<FONT COLOR="blue">Mii</FONT>X Test Cases</B>
|
||||
</CENTER>
|
||||
<P>
|
||||
This document serves to test basic XSL expressions.
|
||||
</P>
|
||||
<!-- new test -->
|
||||
<P>
|
||||
<B>Testing xsl:variable and xsl:copy-of</B><BR/>
|
||||
<B>Test:</B> <xsl:copy-of select="$product-name"/><BR/>
|
||||
<B>Desired Result:</B>Transfor<FONT COLOR="blue">Mii</FONT>X<BR/>
|
||||
<B>Result:</B><xsl:copy-of select="$product-name"/>
|
||||
</P>
|
||||
<!-- new test -->
|
||||
<P>
|
||||
<B>Testing xsl:if</B><BR/>
|
||||
<B>Test:</B> <xsl:if test="x | y | z">true</xsl:if><BR/>
|
||||
<B>Desired Result:</B> true<BR/>
|
||||
<B>Result:</B> <xsl:if test="x | y | z">true</xsl:if>
|
||||
</P>
|
||||
|
||||
<!-- new test -->
|
||||
<P>
|
||||
<B>Testing xsl:if</B><BR/>
|
||||
<B>Test:</B> <xsl:if test="true()">true</xsl:if><BR/>
|
||||
<B>Desired Result:</B> true<BR/>
|
||||
<B>Result:</B> <xsl:if test="true()">true</xsl:if>
|
||||
</P>
|
||||
|
||||
<!-- new test -->
|
||||
<P>
|
||||
<B>Testing xsl:if</B><BR/>
|
||||
<B>Test:</B> <xsl:if test="'a'='b'">a equals b</xsl:if><BR/>
|
||||
<B></B> <xsl:if test="'a'!='b'">a does not equal b</xsl:if>
|
||||
<BR/>
|
||||
<B>Desired Result:</B> a does not equal to b<BR/>
|
||||
<B>Result:</B>
|
||||
<xsl:if test="'a'='b'">a equals b<BR/></xsl:if>
|
||||
<xsl:if test="'a'!='b'">a does not equal b</xsl:if>
|
||||
</P>
|
||||
|
||||
<!-- new test -->
|
||||
<P>
|
||||
<B>Testing xsl:if</B><BR/>
|
||||
<B>Test:</B> <xsl:if test="2+1-3"> 2+1-3 is true</xsl:if><BR/>
|
||||
<B> </B><xsl:if test="not(2+1-3)"> not(2+1-3) is true</xsl:if><BR/>
|
||||
<B>Desired Result:</B>not(2+1-3) is true <BR/>
|
||||
<B>Result:</B>
|
||||
<xsl:if test="2+1-3">2+1-3 is true</xsl:if>
|
||||
<xsl:if test="not(2+1-3)">not(2+1-3) is true</xsl:if>
|
||||
</P>
|
||||
|
||||
<!-- new test -->
|
||||
<P>
|
||||
<B>Testing xsl:choose</B><BR/>
|
||||
<B>Test:</B>see source<BR/>
|
||||
<B>Desired Result:</B> true<BR/>
|
||||
<B>Result:</B>
|
||||
<xsl:choose>
|
||||
<xsl:when test="a">error - a</xsl:when>
|
||||
<xsl:when test="abc/def">true</xsl:when>
|
||||
<xsl:when test="b">error - b</xsl:when>
|
||||
<xsl:otherwise>false</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</P>
|
||||
<!-- new test -->
|
||||
<P>
|
||||
<B>Testing parent and ancestor ops</B><BR/>
|
||||
<B>Test:</B>see source<BR/>
|
||||
<B>Desired Result:</B> true<BR/>
|
||||
<B>Result:</B><xsl:if test="//def">true</xsl:if><BR/>
|
||||
|
||||
</P>
|
||||
<!-- new test -->
|
||||
|
||||
<P>
|
||||
<B>Testing basic xsl:apply-templates</B><BR/>
|
||||
<B>Test:</B><xsl:apply-templates/><BR/>
|
||||
<B>Desired Result:</B>element <B>x</B>, element <B>y</B>, element <B>z</B><BR/>
|
||||
<B>Result:</B><xsl:apply-templates select="x|y|z"/>
|
||||
</P>
|
||||
<!-- new test -->
|
||||
|
||||
<P>
|
||||
<B>Testing basic xsl:apply-templates with mode</B><BR/>
|
||||
<B>Test:</B><xsl:apply-templates mode="mode-test"/><BR/>
|
||||
<B>Desired Result:</B>x, y, z<BR/>
|
||||
<B>Result:</B><xsl:apply-templates select="x|y|z" mode="mode-test"/>
|
||||
</P>
|
||||
<!-- new test -->
|
||||
<P>
|
||||
<B>Testing predicates</B><BR/>
|
||||
<B>Test:</B>see source<BR/>
|
||||
<B>Desired Result:</B> <B>z</B><BR/>
|
||||
<B>Result:</B>
|
||||
<xsl:for-each select="*[position()=3]">
|
||||
<B><xsl:value-of select="."/></B>
|
||||
</xsl:for-each>
|
||||
</P>
|
||||
<!-- new test -->
|
||||
<P>
|
||||
<B>Testing predicates</B><BR/>
|
||||
<B>Test:</B>see source<BR/>
|
||||
<B>Desired Result:</B><BR/>
|
||||
<B>Result:</B>
|
||||
<xsl:for-each select="*[false()]">
|
||||
<B><xsl:value-of select="."/></B>
|
||||
</xsl:for-each>
|
||||
</P>
|
||||
<!-- new test -->
|
||||
<P>
|
||||
<B>Named Template/Call Template</B>
|
||||
<P>
|
||||
<B>Test:</B><xsl:call-template name="named-template-test"/><BR/>
|
||||
<B>Desired Result:</B>named template processed with default value!<BR/>
|
||||
<B>Result:</B><xsl:call-template name="named-template-test"/>
|
||||
</P>
|
||||
<P>
|
||||
<B>Test:</B> - passing arguments to named templates (see xsl source)<BR/>
|
||||
<B>Desired Result:</B>named template processed with passed value!<BR/>
|
||||
<B>Result:</B>
|
||||
<xsl:call-template name="named-template-test">
|
||||
<xsl:with-param name="my-param" select="'passed value'"/>
|
||||
<xsl:with-param name="dummy-param" select="'test'"/>
|
||||
</xsl:call-template>
|
||||
</P>
|
||||
</P>
|
||||
<!-- new test -->
|
||||
<P>
|
||||
<B>Attribute Value Templates and variables</B><BR/>
|
||||
<B>Test:</B>
|
||||
<UL>
|
||||
<xsl:variable name="color">red</xsl:variable><BR/>
|
||||
<FONT COLOR="{$color}">Red Text</FONT>
|
||||
</UL>
|
||||
<B>Desired Result:</B>
|
||||
<FONT COLOR="red">Red Text</FONT><BR/>
|
||||
<B>Result:</B>
|
||||
<xsl:variable name="color">red</xsl:variable>
|
||||
<FONT COLOR="{$color}">Red Text</FONT>
|
||||
</P>
|
||||
<HR/>
|
||||
<!-- AXIS IDENTIFIER TESTS -->
|
||||
<TABLE>
|
||||
<TR BGColor="#E0E0FF">
|
||||
<TD Colspan="2" ALIGN="CENTER">
|
||||
<B>Axis Identifiers (these should work, I need more test cases though)</B>
|
||||
</TD>
|
||||
</TR>
|
||||
<!-- new test -->
|
||||
<TR>
|
||||
<TD VALIGN="TOP"><B>Test:</B></TD>
|
||||
<TD>
|
||||
<xsl:if test="descendant::z">true</xsl:if><BR />
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Desired Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">true</FONT><BR/>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Result:</B></TD>
|
||||
<TD>
|
||||
<xsl:if test="descendant::z">
|
||||
<FONT COLOR="blue">true</FONT>
|
||||
</xsl:if>
|
||||
</TD>
|
||||
</TR>
|
||||
<!-- new test -->
|
||||
<TR>
|
||||
<TD VALIGN="TOP"><B>Test:</B></TD>
|
||||
<TD>
|
||||
<xsl:if test="not(descendant-or-self::no-element)">true</xsl:if><BR />
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Desired Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">true</FONT><BR/>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Result:</B></TD>
|
||||
<TD>
|
||||
<xsl:if test="not(descendant-or-self::no-element)">
|
||||
<FONT COLOR="blue">true</FONT>
|
||||
</xsl:if>
|
||||
</TD>
|
||||
</TR>
|
||||
<!-- new test -->
|
||||
<TR>
|
||||
<TD VALIGN="TOP"><B>Test:</B></TD>
|
||||
<TD>
|
||||
<xsl:value-of select="count(x/attribute::*)"/><BR />
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Desired Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">1</FONT><BR/>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue"><xsl:value-of select="count(x/attribute::*)"/></FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<HR/>
|
||||
<TABLE>
|
||||
<TR BGColor="#E0E0FF">
|
||||
<TD Colspan="2" ALIGN="CENTER">
|
||||
<B>Creating Elements with xsl:element and xsl:attribute</B>
|
||||
</TD>
|
||||
</TR>
|
||||
<!-- new test -->
|
||||
<TR>
|
||||
<TD VALIGN="TOP"><B>Test:</B></TD>
|
||||
<TD>
|
||||
<xsl:element name="FONT"><BR />
|
||||
<xsl:attribute name="COLOR">blue</xsl:attribute> <BR/>
|
||||
Passed <BR/>
|
||||
</xsl:element>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Desired Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">Passed</FONT><BR/>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Result:</B></TD>
|
||||
<TD>
|
||||
<xsl:element name="FONT">
|
||||
<xsl:attribute name="COLOR">blue</xsl:attribute>
|
||||
Passed
|
||||
</xsl:element>
|
||||
</TD>
|
||||
</TR>
|
||||
<!-- new test -->
|
||||
<TR BGCOLOR="#E0E0FF" ALIGN="CENTER">
|
||||
<TD COLSPAN="2"><B>Using Attribute Sets</B></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP"><B>Test:</B></TD>
|
||||
<TD>
|
||||
<FONT xsl:use-attribute-sets="style1"><BR />
|
||||
Passed <BR/>
|
||||
</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Desired Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">Passed</FONT><BR/>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Result:</B></TD>
|
||||
<TD>
|
||||
<FONT xsl:use-attribute-sets="style1">
|
||||
Passed
|
||||
</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
<!-- new test -->
|
||||
<TR>
|
||||
<TD VALIGN="TOP"><B>Test:</B></TD>
|
||||
<TD>
|
||||
<xsl:element name="FONT" use-attribute-sets="style1 style2"><BR />
|
||||
Passed <BR/>
|
||||
</xsl:element>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Desired Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="red">Passed</FONT><BR/>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Result:</B></TD>
|
||||
<TD>
|
||||
<xsl:element name="FONT" use-attribute-sets="style1 style2">
|
||||
Passed
|
||||
</xsl:element>
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<HR/>
|
||||
<!-- NUMBERING Examples -->
|
||||
<TABLE>
|
||||
<TR BGColor="#E0E0FF">
|
||||
<TD Colspan="2" ALIGN="CENTER">
|
||||
<B>Numbering (only simple numbering currently implemented)</B>
|
||||
</TD>
|
||||
</TR>
|
||||
<!-- new test -->
|
||||
<TR>
|
||||
<TD VALIGN="TOP"><B>Test:</B></TD>
|
||||
<TD>
|
||||
<xsl:number value="4"/><BR />
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Desired Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">4</FONT><BR/>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue"><xsl:number value="4"/></FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
<!-- new test -->
|
||||
<TR>
|
||||
<TD VALIGN="TOP"><B>Test:</B></TD>
|
||||
<TD>
|
||||
see source<BR />
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Desired Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">
|
||||
1. x <BR/>1. y<BR/>1. z
|
||||
</FONT><BR/>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">
|
||||
<xsl:for-each select="x | y | z">
|
||||
<xsl:number/>
|
||||
<xsl:text>. </xsl:text><xsl:value-of select="."/><BR/>
|
||||
</xsl:for-each>
|
||||
</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
</TABLE>
|
||||
|
||||
<HR/>
|
||||
<!-- ADDITIVE EXPRESSION TESTS -->
|
||||
<TABLE>
|
||||
<TR BGColor="#E0E0FF">
|
||||
<TD Colspan="2" ALIGN="CENTER">
|
||||
<B>Additive Expressions</B>
|
||||
</TD>
|
||||
</TR>
|
||||
<!-- new test -->
|
||||
<TR>
|
||||
<TD VALIGN="TOP"><B>Test:</B></TD>
|
||||
<TD>
|
||||
<xsl:value-of select="70+4"/><BR />
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Desired Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">74</FONT><BR/>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">
|
||||
<xsl:value-of select="70+4"/>
|
||||
</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
<!-- new test -->
|
||||
<TR>
|
||||
<TD VALIGN="TOP"><B>Test:</B></TD>
|
||||
<TD>
|
||||
<xsl:value-of select="-70+4"/><BR />
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Desired Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">-66</FONT><BR/>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">
|
||||
<xsl:value-of select="-70+4"/>
|
||||
</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP"><B>Test:</B></TD>
|
||||
<TD>
|
||||
<xsl:value-of select="1900+70+8-4"/><BR />
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Desired Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">1974</FONT><BR/>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">
|
||||
<xsl:value-of select="1900+70+8-4"/>
|
||||
</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP"><B>Test:</B></TD>
|
||||
<TD>
|
||||
<xsl:value-of select="(4+5)-(9+9)"/><BR />
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Desired Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">-9</FONT><BR/>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">
|
||||
<xsl:value-of select="(4+5)-(9+9)"/>
|
||||
</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
</TABLE>
|
||||
<HR/>
|
||||
<!-- MULTIPLICATIVE EXPRESSION TESTS -->
|
||||
<TABLE>
|
||||
<TR BGColor="#E0E0FF">
|
||||
<TD Colspan="2" ALIGN="CENTER">
|
||||
<B>Multiplicative Expressions</B>
|
||||
</TD>
|
||||
</TR>
|
||||
<!-- new test -->
|
||||
<TR>
|
||||
<TD VALIGN="TOP"><B>Test:</B></TD>
|
||||
<TD>
|
||||
<xsl:value-of select="7*4"/><BR />
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Desired Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">28</FONT><BR/>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">
|
||||
<xsl:value-of select="7*4"/>
|
||||
</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
<!-- new test -->
|
||||
<TR>
|
||||
<TD VALIGN="TOP"><B>Test:</B></TD>
|
||||
<TD>
|
||||
<xsl:value-of select="7mod 4"/><BR />
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Desired Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">3</FONT><BR/>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">
|
||||
<xsl:value-of select="7mod 4"/>
|
||||
</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
<!-- new test -->
|
||||
<TR>
|
||||
<TD VALIGN="TOP"><B>Test:</B></TD>
|
||||
<TD>
|
||||
<xsl:value-of select="7div 4"/><BR />
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Desired Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">1.75</FONT><BR/>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">
|
||||
<xsl:value-of select="7div 4"/>
|
||||
</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
<!-- new test -->
|
||||
<TR>
|
||||
<TD VALIGN="TOP"><B>Test:</B></TD>
|
||||
<TD>
|
||||
<xsl:value-of select="7div 0"/><BR />
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Desired Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">Infinity</FONT><BR/>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">
|
||||
<xsl:value-of select="7div 0"/>
|
||||
</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
<!-- new test -->
|
||||
<TR>
|
||||
<TD VALIGN="TOP"><B>Test:</B></TD>
|
||||
<TD>
|
||||
<xsl:value-of select="0 div 0"/><BR />
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Desired Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">NaN</FONT><BR/>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">
|
||||
<xsl:value-of select="0 div 0"/>
|
||||
</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<!-- new test -->
|
||||
<TR>
|
||||
<TD VALIGN="TOP"><B>Test:</B></TD>
|
||||
<TD>
|
||||
<xsl:variable name="x" select="7*3"/><BR />
|
||||
<xsl:variable name="y" select="3"/><BR />
|
||||
<xsl:value-of select="$x div $y"/><BR />
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Desired Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">7</FONT><BR/>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">
|
||||
<xsl:variable name="x" select="7*3"/>
|
||||
<xsl:variable name="y" select="3"/>
|
||||
<xsl:value-of select="$x div $y"/>
|
||||
<BR/>
|
||||
|
||||
</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<!-- PRECEDENCE TESTS -->
|
||||
<TABLE>
|
||||
<TR BGColor="#E0E0FF">
|
||||
<TD Colspan="2" ALIGN="CENTER">
|
||||
<B>Precedence tests</B>
|
||||
</TD>
|
||||
</TR>
|
||||
<!-- new test -->
|
||||
<TR>
|
||||
<TD VALIGN="TOP"><B>Test:</B></TD>
|
||||
<TD>
|
||||
<xsl:value-of select="2 mod 2 = 0"/><BR />
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Desired Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">true</FONT><BR/>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">
|
||||
<xsl:value-of select="2 mod 2 = 0"/>
|
||||
</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
<!-- new test -->
|
||||
<TR>
|
||||
<TD VALIGN="TOP"><B>Test:</B></TD>
|
||||
<TD>
|
||||
<xsl:value-of select="5 mod 2 < 5 and 2*6 >= 12"/><BR />
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Desired Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">true</FONT><BR/>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">
|
||||
<xsl:value-of select="5 mod 2 < 5 and 2*6>=12"/>
|
||||
</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
<!-- new test -->
|
||||
<TR>
|
||||
<TD VALIGN="TOP"><B>Test:</B></TD>
|
||||
<TD>
|
||||
<xsl:value-of select="5 mod 2 < 5 and 2*6>12"/><BR />
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Desired Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">false</FONT><BR/>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">
|
||||
<xsl:value-of select="5 mod 2 < 5 and 2*6>12"/>
|
||||
</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<!-- new test -->
|
||||
<TR>
|
||||
<TD VALIGN="TOP"><B>Test:</B></TD>
|
||||
<TD>
|
||||
<xsl:value-of select="4+5*3"/><BR />
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Desired Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">19</FONT><BR/>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">
|
||||
<xsl:value-of select="4+5*3"/>
|
||||
</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
<!-- new test -->
|
||||
<TR>
|
||||
<TD VALIGN="TOP"><B>Test:</B></TD>
|
||||
<TD>
|
||||
<xsl:value-of select="4+5*3+(6-4)*7"/><BR />
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Desired Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">33</FONT><BR/>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">
|
||||
<xsl:value-of select="4+5*3+(6-4)*7"/>
|
||||
</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<!-- Result Type conversion tests -->
|
||||
<TABLE>
|
||||
<TR BGColor="#E0E0FF">
|
||||
<TD Colspan="2" ALIGN="CENTER">
|
||||
<B>Automatic Result Type Conversion</B>
|
||||
</TD>
|
||||
</TR>
|
||||
<!-- new test -->
|
||||
<TR>
|
||||
<TD VALIGN="TOP"><B>Test:</B></TD>
|
||||
<TD>
|
||||
<xsl:value-of select="'747' + 8"/><BR />
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Desired Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">755</FONT><BR/>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><B>Result:</B></TD>
|
||||
<TD>
|
||||
<FONT COLOR="blue">
|
||||
<xsl:value-of select="'747' + 8"/>
|
||||
</FONT>
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</BODY>
|
||||
</HTML>
|
||||
</xsl:template>
|
||||
|
||||
<!-- simple union expressions -->
|
||||
<xsl:template match="x | y | z" priority="1.0">
|
||||
element<B><xsl:text> </xsl:text><xsl:value-of select="@*"/></B>
|
||||
<xsl:if test="not(position()=3)">,</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="x | y | z" mode="mode-test">
|
||||
<xsl:value-of select="@*"/>
|
||||
<xsl:if test="not(position()=3)"><xsl:text>, </xsl:text></xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="z">
|
||||
element (z): <B><xsl:value-of select="."/></B>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
@ -1,105 +0,0 @@
|
||||
<?xml version="1.0"?><!-- -*- Mode: xml; tab-width: 2; indent-tabs-mode: nil -*- -->
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla Public License Version
|
||||
- 1.1 (the "License"); you may not use this file except in compliance with
|
||||
- the License. You may obtain a copy of the License at
|
||||
- http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS IS" basis,
|
||||
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
- for the specific language governing rights and limitations under the
|
||||
- License.
|
||||
-
|
||||
- The Original Code is TransforMiiX XSLT processor code.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- Keith Visco.
|
||||
- Portions created by the Initial Developer are Copyright (C) 2000
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
- Keith Visco <kvisco@ziplink.net> (Original Author)
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<!--
|
||||
This is a test stylesheet used for testing TransforMiiX
|
||||
-->
|
||||
|
||||
<!DOCTYPE xsl:stylesheet [
|
||||
<!ENTITY cr "
">
|
||||
]>
|
||||
|
||||
<xsl:stylesheet
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
version="1.0">
|
||||
|
||||
<!-- root template -->
|
||||
<xsl:template match="/">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>View Source:</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<!-- Add XML Declaration (as long as we have child nodes!) -->
|
||||
<xsl:if test="node()">
|
||||
<B><?xml version="1.0"?></B><BR/>
|
||||
</xsl:if>
|
||||
<xsl:apply-templates select="node()"/>
|
||||
</BODY>
|
||||
</HTML>
|
||||
</xsl:template>
|
||||
|
||||
<!-- comment template -->
|
||||
<xsl:template match="comment()">
|
||||
<I><!--<xsl:value-of select="."/>--></I>
|
||||
</xsl:template>
|
||||
|
||||
<!-- generic element template -->
|
||||
<xsl:template match="*">
|
||||
|
||||
<!-- open element tag -->
|
||||
<FONT COLOR="blue"><</FONT><FONT COLOR="red"><xsl:value-of select="name(.)"/></FONT>
|
||||
<xsl:apply-templates select="@*"/><FONT COLOR="blue">></FONT>
|
||||
|
||||
<!-- add break if we have element children -->
|
||||
<xsl:if test="*"><BR/></xsl:if>
|
||||
|
||||
<!-- recursively apply templates to children of this element -->
|
||||
<xsl:apply-templates/>
|
||||
|
||||
<!-- close element tag -->
|
||||
<FONT COLOR="blue"></</FONT>
|
||||
<FONT COLOR="red"><xsl:value-of select="name(.)"/></FONT>
|
||||
<FONT COLOR="blue">></FONT>
|
||||
<BR/>
|
||||
</xsl:template>
|
||||
|
||||
<!-- generic attribute template -->
|
||||
<xsl:template match="@*">
|
||||
 <B><xsl:value-of select="name(.)"/></B>
|
||||
<FONT COLOR="green">="<xsl:value-of select="."/>"</FONT>
|
||||
</xsl:template>
|
||||
|
||||
<!-- processing instruction template -->
|
||||
<xsl:template match="processing-instruction()">
|
||||
<I><?<xsl:value-of select="name(.)"/> <xsl:value-of select="."/>?></I><BR/>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
@ -1,74 +0,0 @@
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is TransforMiiX XSLT processor code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Axel Hecht.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2001
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Axel Hecht <axel@pike.org>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
LIBRARY_NAME = tx
|
||||
FORCE_STATIC_LIB = 1
|
||||
CPP_PROG_LINK = 1
|
||||
MOZILLA_INTERNAL_API = 1
|
||||
|
||||
REQUIRES = string \
|
||||
xpcom \
|
||||
expat \
|
||||
$(NULL)
|
||||
|
||||
SHARED_LIBRARY_LIBS = \
|
||||
$(DIST)/lib/$(LIB_PREFIX)txbase_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)txxml_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)txxmldom_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)txxmlparser_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)txxpath_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)txxslt_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)txxsltfunctions_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)txxsltutil_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)expat_s.$(LIB_SUFFIX) \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
INCLUDES += -I$(srcdir)/../xslt -I$(srcdir)/../base -I$(srcdir)/../net \
|
||||
-I$(srcdir)/../xml -I$(srcdir)/../xml/dom \
|
||||
-I$(srcdir)/../xml/parser \
|
||||
-I$(srcdir)/../xpath -I$(srcdir)/../xslt/util \
|
||||
-I$(srcdir)/../xslt/functions $(MARK_INC)
|
||||
DEFINES += -DXML_DTD -DXML_UNICODE
|
@ -1 +0,0 @@
|
||||
Makefile
|
@ -1,79 +0,0 @@
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is TransforMiiX XSLT processor code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Axel Hecht.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2001
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Axel Hecht <axel@pike.org>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MOZILLA_INTERNAL_API = 1
|
||||
SIMPLE_PROGRAMS = transformiix$(BIN_SUFFIX) testXalan$(BIN_SUFFIX) \
|
||||
txTestExpr$(BIN_SUFFIX)
|
||||
ifdef MARK_INC
|
||||
SIMPLE_PROGRAMS += txXSLTMarkDriver$(BIN_SUFFIX)
|
||||
endif
|
||||
|
||||
REQUIRES = string \
|
||||
xpcom \
|
||||
expat \
|
||||
jprof \
|
||||
$(NULL)
|
||||
|
||||
CPP_PROG_LINK = 1
|
||||
|
||||
EXTRA_DEPS = \
|
||||
$(DIST)/lib/$(LIB_PREFIX)tx.$(LIB_SUFFIX) \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_LIBS = \
|
||||
$(DIST)/lib/$(LIB_PREFIX)tx.$(LIB_SUFFIX) \
|
||||
$(MOZ_COMPONENT_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_JPROF
|
||||
LIBS += -ljprof
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
INCLUDES += -I$(srcdir)/../xslt -I$(srcdir)/../base -I$(srcdir)/../net \
|
||||
-I$(srcdir)/../xml -I$(srcdir)/../xml/dom \
|
||||
-I$(srcdir)/../xml/parser \
|
||||
-I$(srcdir)/../xpath -I$(srcdir)/../xslt/util \
|
||||
-I$(srcdir)/../xslt/functions $(MARK_INC)
|
@ -1,424 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Axel Hecht.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2003
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Axel Hecht <axel@pike.org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "txStandaloneXSLTProcessor.h"
|
||||
#include "nsXPCOM.h"
|
||||
#include <fstream.h>
|
||||
#include "nsDoubleHashtable.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsILocalFile.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
#include "nsString.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "prenv.h"
|
||||
#include "prsystem.h"
|
||||
#include "nsDirectoryServiceUtils.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
|
||||
#ifdef NS_TRACE_MALLOC
|
||||
#include "nsTraceMalloc.h"
|
||||
#endif
|
||||
#ifdef MOZ_JPROF
|
||||
#include "jprof.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Prints the command line help screen to the console
|
||||
*/
|
||||
void printHelp()
|
||||
{
|
||||
cerr << "testXalan [-o output-file] [category]*" << endl << endl;
|
||||
cerr << "Options:";
|
||||
cerr << endl << endl;
|
||||
cerr << "\t-o specify output file (default: write to stdout)";
|
||||
cerr << endl << endl;
|
||||
cerr << "\t Specify XALAN_DIR in your environement." << endl;
|
||||
cerr << endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper class to report success and failure to RDF
|
||||
*/
|
||||
class txRDFOut
|
||||
{
|
||||
public:
|
||||
explicit txRDFOut(ostream* aOut)
|
||||
: mOut(aOut), mSuccess(0), mFail(0), mParent(nsnull)
|
||||
{
|
||||
}
|
||||
explicit txRDFOut(const nsACString& aName, txRDFOut* aParent)
|
||||
: mName(aName), mOut(aParent->mOut), mSuccess(0), mFail(0),
|
||||
mParent(aParent)
|
||||
{
|
||||
}
|
||||
~txRDFOut()
|
||||
{
|
||||
*mOut << " <RDF:Description about=\"urn:x-buster:conf" <<
|
||||
mName.get() <<
|
||||
"\">\n" <<
|
||||
" <NC:orig_succCount NC:parseType=\"Integer\">" <<
|
||||
mSuccess <<
|
||||
"</NC:orig_succCount>\n" <<
|
||||
" <NC:orig_failCount NC:parseType=\"Integer\">" <<
|
||||
mFail <<
|
||||
"</NC:orig_failCount>\n" <<
|
||||
" </RDF:Description>" << endl;
|
||||
}
|
||||
|
||||
void feed(const nsACString& aTest, PRBool aSuccess)
|
||||
{
|
||||
*mOut << " <RDF:Description about=\"urn:x-buster:" <<
|
||||
PromiseFlatCString(aTest).get() <<
|
||||
"\"\n NC:orig_succ=\"";
|
||||
if (aSuccess) {
|
||||
*mOut << "yes";
|
||||
succeeded();
|
||||
}
|
||||
else {
|
||||
*mOut << "no";
|
||||
failed();
|
||||
}
|
||||
*mOut << "\" />\n";
|
||||
}
|
||||
|
||||
void succeeded()
|
||||
{
|
||||
if (mParent)
|
||||
mParent->succeeded();
|
||||
++mSuccess;
|
||||
}
|
||||
void failed()
|
||||
{
|
||||
if (mParent)
|
||||
mParent->failed();
|
||||
++mFail;
|
||||
}
|
||||
private:
|
||||
nsCAutoString mName;
|
||||
ostream* mOut;
|
||||
PRUint32 mSuccess, mFail;
|
||||
txRDFOut* mParent;
|
||||
};
|
||||
|
||||
static void
|
||||
readToString(istream& aIstream, nsACString& aString)
|
||||
{
|
||||
static char buffer[1024];
|
||||
int read = 0;
|
||||
do {
|
||||
aIstream.read(buffer, 1024);
|
||||
read = aIstream.gcount();
|
||||
aString.Append(Substring(buffer, buffer + read));
|
||||
} while (!aIstream.eof());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the XALAN_DIR environment variable and return a nsIFile for
|
||||
* the conf and the conf-gold subdirectory. Create a TEMP file, too.
|
||||
* Return an error if either does not exist.
|
||||
*/
|
||||
static nsresult
|
||||
setupXalan(const char* aPath, nsIFile** aConf, nsIFile** aConfGold,
|
||||
nsIFile** aTemp)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsILocalFile> conf(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID,
|
||||
&rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr <nsIFile> tmpFile;
|
||||
rv = NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(tmpFile));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
tmpFile->Append(NS_LITERAL_STRING("xalan.out"));
|
||||
rv = tmpFile->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 0600);
|
||||
rv = conf->InitWithNativePath(nsDependentCString(aPath));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIFile> gold;
|
||||
rv = conf->Clone(getter_AddRefs(gold));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = conf->Append(NS_LITERAL_STRING("conf"));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
PRBool isDir;
|
||||
rv = conf->IsDirectory(&isDir);
|
||||
if (NS_FAILED(rv) || !isDir) {
|
||||
return NS_ERROR_FILE_NOT_DIRECTORY;
|
||||
}
|
||||
rv = gold->Append(NS_LITERAL_STRING("conf-gold"));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = gold->IsDirectory(&isDir);
|
||||
if (NS_FAILED(rv) || !isDir || !conf || !gold) {
|
||||
return NS_ERROR_FILE_NOT_DIRECTORY;
|
||||
}
|
||||
// got conf and conf-gold subdirectories
|
||||
*aConf = conf;
|
||||
NS_ADDREF(*aConf);
|
||||
*aConfGold = gold;
|
||||
NS_ADDREF(*aConfGold);
|
||||
*aTemp = tmpFile;
|
||||
NS_ADDREF(*aTemp);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run a category of Xalan tests
|
||||
*/
|
||||
void runCategory(nsIFile* aConfCat, nsIFile* aGoldCat, nsIFile* aRefTmp,
|
||||
txRDFOut* aOut)
|
||||
{
|
||||
nsresult rv;
|
||||
//clone the nsIFiles, so that we can return easily
|
||||
nsCOMPtr<nsIFile> conf, gold;
|
||||
aConfCat->Clone(getter_AddRefs(conf));
|
||||
aGoldCat->Clone(getter_AddRefs(gold));
|
||||
nsCAutoString catName, refTmp;
|
||||
conf->GetNativeLeafName(catName);
|
||||
aRefTmp->GetNativePath(refTmp);
|
||||
txRDFOut results(catName, aOut);
|
||||
nsCOMPtr<nsISimpleEnumerator> tests;
|
||||
rv = conf->GetDirectoryEntries(getter_AddRefs(tests));
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
PRBool hasMore, isFile;
|
||||
nsCAutoString leaf;
|
||||
NS_NAMED_LITERAL_CSTRING(xsl, ".xsl");
|
||||
while (NS_SUCCEEDED(tests->HasMoreElements(&hasMore)) && hasMore) {
|
||||
nsCOMPtr<nsILocalFile> test;
|
||||
tests->GetNext(getter_AddRefs(test));
|
||||
test->GetNativeLeafName(leaf);
|
||||
if (xsl.Equals(Substring(leaf, leaf.Length()-4, 4))) {
|
||||
// we have a stylesheet, let's look for source and reference
|
||||
nsAFlatCString::char_iterator start, ext;
|
||||
leaf.BeginWriting(start);
|
||||
leaf.EndWriting(ext);
|
||||
ext -= 2;
|
||||
// overwrite extension with .xml
|
||||
*ext = 'm'; // this one was easy
|
||||
nsCOMPtr<nsIFile> source;
|
||||
conf->Clone(getter_AddRefs(source));
|
||||
rv = source->AppendNative(leaf);
|
||||
if (NS_SUCCEEDED(rv) && NS_SUCCEEDED(source->IsFile(&isFile)) &&
|
||||
isFile) {
|
||||
nsCOMPtr<nsIFile> reference;
|
||||
gold->Clone(getter_AddRefs(reference));
|
||||
// overwrite extension with .out
|
||||
--ext;
|
||||
nsCharTraits<char>::copy(ext, "out", 3);
|
||||
rv = reference->AppendNative(leaf);
|
||||
if (NS_SUCCEEDED(rv) &&
|
||||
NS_SUCCEEDED(reference->IsFile(&isFile)) &&
|
||||
isFile) {
|
||||
nsCAutoString src, style, refPath;
|
||||
test->GetNativePath(style);
|
||||
source->GetNativePath(src);
|
||||
reference->GetNativePath(refPath);
|
||||
if (PR_GetDirectorySeparator() =='\\') {
|
||||
src.ReplaceChar('\\','/');
|
||||
style.ReplaceChar('\\','/');
|
||||
refPath.ReplaceChar('\\','/');
|
||||
}
|
||||
SimpleErrorObserver obs;
|
||||
txStandaloneXSLTProcessor proc;
|
||||
fstream result(refTmp.get(),
|
||||
ios::in | ios::out | ios::trunc);
|
||||
rv = proc.transform(src, style, result, obs);
|
||||
PRBool success = PR_FALSE;
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
result.flush();
|
||||
PRInt64 resultSize, refSize;
|
||||
aRefTmp->GetFileSize(&resultSize);
|
||||
reference->GetFileSize(&refSize);
|
||||
result.seekg(0);
|
||||
int toread = (int)resultSize;
|
||||
nsCString resContent, refContent;
|
||||
resContent.SetCapacity(toread);
|
||||
readToString(result, resContent);
|
||||
result.close();
|
||||
ifstream refStream(refPath.get());
|
||||
toread = (int)refSize;
|
||||
refContent.SetCapacity(toread);
|
||||
readToString(refStream, refContent);
|
||||
refStream.close();
|
||||
success = resContent.Equals(refContent);
|
||||
}
|
||||
ext--;
|
||||
results.feed(Substring(start, ext), success);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* The Xalan testcases app
|
||||
*/
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
#ifdef NS_TRACE_MALLOC
|
||||
NS_TraceMallocStartupArgs(argc, argv);
|
||||
#endif
|
||||
#ifdef MOZ_JPROF
|
||||
setupProfilingStuff();
|
||||
#endif
|
||||
char* xalan = PR_GetEnv("XALAN_DIR");
|
||||
if (!xalan) {
|
||||
printHelp();
|
||||
return 1;
|
||||
}
|
||||
nsresult rv;
|
||||
rv = NS_InitXPCOM2(nsnull, nsnull, nsnull);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIFile> conf, gold, resFile;
|
||||
rv = setupXalan(xalan, getter_AddRefs(conf), getter_AddRefs(gold),
|
||||
getter_AddRefs(resFile));
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_ShutdownXPCOM(nsnull);
|
||||
printHelp();
|
||||
return -1;
|
||||
}
|
||||
|
||||
//-- handle output stream
|
||||
ostream* resultOutput = &cout;
|
||||
ofstream resultFileStream;
|
||||
|
||||
int argn = 1;
|
||||
// skip -- gnu style options
|
||||
while (argn < argc) {
|
||||
nsDependentCString opt(argv[argn]);
|
||||
if (!Substring(opt, 0, 2).EqualsLiteral("--")) {
|
||||
break;
|
||||
}
|
||||
++argn;
|
||||
}
|
||||
if (argn < argc) {
|
||||
nsDependentCString opt(argv[argn]);
|
||||
if (Substring(opt, 0, 2).EqualsLiteral("-o")) {
|
||||
if (opt.Length() > 2) {
|
||||
const nsAFlatCString& fname =
|
||||
PromiseFlatCString(Substring(opt, 2, opt.Length()-2));
|
||||
resultFileStream.open(fname.get(), ios::out);
|
||||
}
|
||||
else {
|
||||
++argn;
|
||||
if (argn < argc) {
|
||||
resultFileStream.open(argv[argn], ios::out);
|
||||
}
|
||||
}
|
||||
if (!resultFileStream) {
|
||||
cerr << "error opening output file" << endl;
|
||||
PRBool exists;
|
||||
if (NS_SUCCEEDED(resFile->Exists(&exists)) && exists)
|
||||
resFile->Remove(PR_FALSE);
|
||||
NS_ShutdownXPCOM(nsnull);
|
||||
return -1;
|
||||
}
|
||||
++argn;
|
||||
resultOutput = &resultFileStream;
|
||||
}
|
||||
}
|
||||
|
||||
if (!txXSLTProcessor::init()) {
|
||||
PRBool exists;
|
||||
if (NS_SUCCEEDED(resFile->Exists(&exists)) && exists)
|
||||
resFile->Remove(PR_FALSE);
|
||||
NS_ShutdownXPCOM(nsnull);
|
||||
return 1;
|
||||
}
|
||||
|
||||
*resultOutput << "<?xml version=\"1.0\"?>\n" <<
|
||||
"<RDF:RDF xmlns:NC=\"http://home.netscape.com/NC-rdf#\"\n" <<
|
||||
" xmlns:RDF=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">" << endl;
|
||||
|
||||
txRDFOut* rdfOut = new txRDFOut(resultOutput);
|
||||
nsCOMPtr<nsIFile> tempFile;
|
||||
if (argn < argc) {
|
||||
// categories are specified
|
||||
while (argn < argc) {
|
||||
nsDependentCString cat(argv[argn++]);
|
||||
rv = conf->AppendNative(cat);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = gold->AppendNative(cat);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
runCategory(conf, gold, resFile, rdfOut);
|
||||
rv = gold->GetParent(getter_AddRefs(tempFile));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "can't go back?");
|
||||
gold = tempFile;
|
||||
}
|
||||
rv = conf->GetParent(getter_AddRefs(tempFile));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "can't go back?");
|
||||
conf = tempFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// no category specified, do everything
|
||||
nsCOMPtr<nsISimpleEnumerator> cats;
|
||||
rv = conf->GetDirectoryEntries(getter_AddRefs(cats));
|
||||
PRBool hasMore, isDir;
|
||||
nsCAutoString leaf;
|
||||
while (NS_SUCCEEDED(cats->HasMoreElements(&hasMore)) && hasMore) {
|
||||
nsCOMPtr<nsILocalFile> cat;
|
||||
cats->GetNext(getter_AddRefs(cat));
|
||||
rv = cat->IsDirectory(&isDir);
|
||||
if (NS_SUCCEEDED(rv) && isDir) {
|
||||
rv = cat->GetNativeLeafName(leaf);
|
||||
if (NS_SUCCEEDED(rv) &&
|
||||
!leaf.EqualsLiteral("CVS")) {
|
||||
rv = gold->AppendNative(leaf);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
runCategory(cat, gold, resFile, rdfOut);
|
||||
rv = gold->GetParent(getter_AddRefs(tempFile));
|
||||
gold = tempFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
delete rdfOut;
|
||||
rdfOut = nsnull;
|
||||
*resultOutput << "</RDF:RDF>" << endl;
|
||||
PRBool exists;
|
||||
if (NS_SUCCEEDED(resFile->Exists(&exists)) && exists)
|
||||
resFile->Remove(PR_FALSE);
|
||||
resultFileStream.close();
|
||||
txXSLTProcessor::shutdown();
|
||||
rv = NS_ShutdownXPCOM(nsnull);
|
||||
#ifdef NS_TRACE_MALLOC
|
||||
NS_TraceMallocShutdown();
|
||||
#endif
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return 0;
|
||||
}
|
@ -1,209 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The MITRE Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1999
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "txStandaloneXSLTProcessor.h"
|
||||
#include "nsXPCOM.h"
|
||||
#include <fstream.h>
|
||||
#include "nsDoubleHashtable.h"
|
||||
#include "nsVoidArray.h"
|
||||
#ifdef MOZ_JPROF
|
||||
#include "jprof.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Prints the command line help screen to the console
|
||||
*/
|
||||
void printHelp()
|
||||
{
|
||||
cerr << "transfrmx [-h] [-i xml-file] [-s xslt-file] [-o output-file]" << endl << endl;
|
||||
cerr << "Options:";
|
||||
cerr << endl << endl;
|
||||
cerr << "\t-i specify XML file to process" << endl;
|
||||
cerr << "\t-s specify XSLT file to use for processing (default: use stylesheet" << endl
|
||||
<< "\t\tspecified in XML file)" << endl;
|
||||
cerr << "\t-o specify output file (default: write to stdout)" << endl;
|
||||
cerr << "\t-h this help screen" << endl;
|
||||
cerr << endl;
|
||||
cerr << "You may use '-' in place of the output-file to explicitly specify" << endl;
|
||||
cerr << "standard output." << endl;
|
||||
cerr << endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the command line usage information to the console
|
||||
*/
|
||||
void printUsage()
|
||||
{
|
||||
cerr << "transfrmx [-h] [-i xml-file] [-s xslt-file] [-o output-file]" << endl << endl;
|
||||
cerr << "For more infomation use the -h flag" << endl;
|
||||
}
|
||||
|
||||
class txOptionEntry : public PLDHashCStringEntry
|
||||
{
|
||||
public:
|
||||
txOptionEntry(const void* aKey) : PLDHashCStringEntry(aKey)
|
||||
{
|
||||
}
|
||||
~txOptionEntry()
|
||||
{
|
||||
}
|
||||
nsCStringArray mValues;
|
||||
};
|
||||
|
||||
DECL_DHASH_WRAPPER(txOptions, txOptionEntry, nsACString&)
|
||||
DHASH_WRAPPER(txOptions, txOptionEntry, nsACString&)
|
||||
|
||||
/**
|
||||
* Parses the command line
|
||||
*/
|
||||
void parseCommandLine(int argc, char** argv, txOptions& aOptions)
|
||||
{
|
||||
nsCAutoString flag;
|
||||
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
nsDependentCString arg(argv[i]);
|
||||
if (*argv[i] == '-' && arg.Length() > 1) {
|
||||
// clean up previous flag
|
||||
if (!flag.IsEmpty()) {
|
||||
aOptions.AddEntry(flag);
|
||||
flag.Truncate();
|
||||
}
|
||||
|
||||
// get next flag
|
||||
flag = Substring(arg, 1, arg.Length() - 1);
|
||||
}
|
||||
else {
|
||||
txOptionEntry* option = aOptions.AddEntry(flag);
|
||||
if (option) {
|
||||
option->mValues.AppendCString(nsCString(arg));
|
||||
}
|
||||
flag.Truncate();
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag.IsEmpty()) {
|
||||
aOptions.AddEntry(flag);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The TransforMiiX command line interface
|
||||
*/
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
using namespace std;
|
||||
nsresult rv;
|
||||
#ifdef MOZ_JPROF
|
||||
setupProfilingStuff();
|
||||
#endif
|
||||
rv = NS_InitXPCOM2(nsnull, nsnull, nsnull);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!txXSLTProcessor::init())
|
||||
return 1;
|
||||
|
||||
txOptions options;
|
||||
if (NS_FAILED(options.Init(4))) {
|
||||
return 1;
|
||||
}
|
||||
parseCommandLine(argc, argv, options);
|
||||
|
||||
if (!options.GetEntry(NS_LITERAL_CSTRING("q"))) {
|
||||
NS_NAMED_LITERAL_CSTRING(copyright, "(C) 1999 The MITRE Corporation, Keith Visco, and contributors");
|
||||
cerr << "TransforMiiX ";
|
||||
cerr << MOZILLA_VERSION << endl;
|
||||
cerr << copyright.get() << endl;
|
||||
//-- print banner line
|
||||
PRUint32 fillSize = copyright.Length() + 1;
|
||||
PRUint32 counter;
|
||||
for (counter = 0; counter < fillSize; ++counter)
|
||||
cerr << '-';
|
||||
cerr << endl << endl;
|
||||
}
|
||||
|
||||
if (options.GetEntry(NS_LITERAL_CSTRING("h"))) {
|
||||
printHelp();
|
||||
return 0;
|
||||
}
|
||||
|
||||
//-- handle output stream
|
||||
ostream* resultOutput = &cout;
|
||||
ofstream resultFileStream;
|
||||
|
||||
txOptionEntry* option = options.GetEntry(NS_LITERAL_CSTRING("o"));
|
||||
if (option &&
|
||||
option->mValues.Count() > 0 &&
|
||||
!option->mValues[0]->EqualsLiteral("-")) {
|
||||
resultFileStream.open(option->mValues[0]->get(), ios::out);
|
||||
if (!resultFileStream) {
|
||||
cerr << "error opening output file: ";
|
||||
cerr << option->mValues[0]->get() << endl;
|
||||
return -1;
|
||||
}
|
||||
resultOutput = &resultFileStream;
|
||||
}
|
||||
|
||||
option = options.GetEntry(NS_LITERAL_CSTRING("i"));
|
||||
if (!option || option->mValues.Count() == 0) {
|
||||
cerr << "you must specify at least a source XML path" << endl;
|
||||
printUsage();
|
||||
return -1;
|
||||
}
|
||||
|
||||
SimpleErrorObserver obs;
|
||||
txStandaloneXSLTProcessor proc;
|
||||
|
||||
txOptionEntry* styleOption = options.GetEntry(NS_LITERAL_CSTRING("s"));
|
||||
if (!styleOption || styleOption->mValues.Count() == 0) {
|
||||
rv = proc.transform(*option->mValues[0], *resultOutput, obs);
|
||||
}
|
||||
else {
|
||||
// XXX TODO: Handle multiple stylesheets
|
||||
rv = proc.transform(*option->mValues[0], *styleOption->mValues[0],
|
||||
*resultOutput, obs);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
cerr << "transformation failed with " << hex << rv << endl;
|
||||
}
|
||||
|
||||
resultFileStream.close();
|
||||
txXSLTProcessor::shutdown();
|
||||
rv = NS_ShutdownXPCOM(nsnull);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return 0;
|
||||
}
|
@ -1,145 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Axel Hecht.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2003
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Axel Hecht <axel@pike.org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsXPCOM.h"
|
||||
#include "txStandaloneXSLTProcessor.h"
|
||||
#include "nsString.h"
|
||||
#include "ExprParser.h"
|
||||
#include "txIXPathContext.h"
|
||||
|
||||
/**
|
||||
* A ExprParser test exe
|
||||
*/
|
||||
|
||||
static const char* kTokens[] = {"(", "concat", "(", "foo", ",", "'", "bar",
|
||||
"'",")", "//", ".", "[", "preceding-sibling",
|
||||
"::", "bar", "]", "/", "*", "[", "23", "]",
|
||||
"|", "node", "(", ")", ")", "<", "3"};
|
||||
static const PRUint8 kCount = sizeof(kTokens)/sizeof(char*);
|
||||
|
||||
class ParseContextImpl : public txIParseContext
|
||||
{
|
||||
public:
|
||||
nsresult
|
||||
resolveNamespacePrefix(nsIAtom* aPrefix, PRInt32& aID)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nsresult
|
||||
resolveFunctionCall(nsIAtom* aName, PRInt32 aID, FunctionCall*& aFunction)
|
||||
{
|
||||
return NS_ERROR_XPATH_UNKNOWN_FUNCTION;
|
||||
}
|
||||
PRBool
|
||||
caseInsensitiveNameTests()
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
void
|
||||
SetErrorOffset(PRUint32 aOffset)
|
||||
{
|
||||
mOff = aOffset;
|
||||
}
|
||||
PRUint32 mOff;
|
||||
};
|
||||
|
||||
static void doTest(const nsASingleFragmentString& aExpr)
|
||||
{
|
||||
ParseContextImpl ct;
|
||||
nsAutoPtr<Expr> expression;
|
||||
cout << NS_LossyConvertUTF16toASCII(aExpr).get() << endl;
|
||||
ct.mOff = 0;
|
||||
nsresult rv = txExprParser::createExpr(aExpr, &ct,
|
||||
getter_Transfers(expression));
|
||||
|
||||
cout << "createExpr returned " << ios::hex << rv << ios::dec;
|
||||
cout << " at " << ct.mOff << endl;
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_LossyConvertUTF16toASCII cstring(aExpr);
|
||||
cout << NS_LossyConvertUTF16toASCII(StringHead(aExpr, ct.mOff)).get();
|
||||
cout << " ^ ";
|
||||
cout << NS_LossyConvertUTF16toASCII(StringTail(aExpr, aExpr.Length()-ct.mOff)).get();
|
||||
cout << endl << endl;
|
||||
}
|
||||
#ifdef TX_TO_STRING
|
||||
else {
|
||||
nsAutoString expr;
|
||||
expression->toString(expr);
|
||||
cout << "parsed expression: ";
|
||||
cout << NS_LossyConvertUTF16toASCII(expr).get() << endl << endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
using namespace std;
|
||||
nsresult rv = NS_InitXPCOM2(nsnull, nsnull, nsnull);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!txXSLTProcessor::init())
|
||||
return 1;
|
||||
|
||||
nsAutoString exprOrig, expr;
|
||||
nsStringArray exprHead, exprTail;
|
||||
PRUint8 i, dropStart, dropEnd;
|
||||
exprHead.AppendString(NS_ConvertASCIItoUTF16(kTokens[0]));
|
||||
exprTail.AppendString(NS_ConvertASCIItoUTF16(kTokens[kCount - 1]));
|
||||
for (i = 2; i < kCount; ++i) {
|
||||
exprHead.AppendString(*exprHead[i - 2] +
|
||||
NS_ConvertASCIItoUTF16(kTokens[i - 1]));
|
||||
exprTail.AppendString(NS_ConvertASCIItoUTF16(kTokens[kCount - i]) +
|
||||
*exprTail[i - 2]);
|
||||
}
|
||||
exprOrig = NS_ConvertASCIItoUTF16(kTokens[0]) + *exprTail[kCount - 2];
|
||||
cout << NS_LossyConvertUTF16toASCII(exprOrig).get() << endl << endl;
|
||||
for (dropStart = 0; dropStart < kCount - 2; ++dropStart) {
|
||||
doTest(*exprTail[kCount - 2 - dropStart]);
|
||||
for (dropEnd = kCount - 3 - dropStart; dropEnd > 0; --dropEnd) {
|
||||
expr = *exprHead[dropStart] + *exprTail[dropEnd];
|
||||
doTest(expr);
|
||||
}
|
||||
doTest(*exprHead[dropStart]);
|
||||
}
|
||||
doTest(*exprHead[kCount - 2]);
|
||||
|
||||
txXSLTProcessor::shutdown();
|
||||
rv = NS_ShutdownXPCOM(nsnull);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return 0;
|
||||
}
|
@ -1,131 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Axel Hecht <axel@pike.org> (Original Author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
* Driver for running XSLTMark on standalone
|
||||
*
|
||||
* See http://www.datapower.com/XSLTMark/
|
||||
*/
|
||||
|
||||
#include "txStandaloneStylesheetCompiler.h"
|
||||
#include "txStandaloneXSLTProcessor.h"
|
||||
#include "nsXPCOM.h"
|
||||
#include "xmExternalDriver.hpp"
|
||||
#ifdef MOZ_JPROF
|
||||
#include "jprof.h"
|
||||
#endif
|
||||
|
||||
class txDriverProcessor : public txStandaloneXSLTProcessor,
|
||||
public xmExternalDriver
|
||||
{
|
||||
public:
|
||||
txDriverProcessor() : mXML(0), mOut(0)
|
||||
{
|
||||
}
|
||||
|
||||
int loadStylesheet (char * filename)
|
||||
{
|
||||
txParsedURL url;
|
||||
url.init(NS_ConvertASCIItoUCS2(filename));
|
||||
nsresult rv =
|
||||
TX_CompileStylesheetPath(url, getter_AddRefs(mStylesheet));
|
||||
return NS_SUCCEEDED(rv) ? 0 : 1;
|
||||
}
|
||||
int setInputDocument (char * filename)
|
||||
{
|
||||
delete mXML;
|
||||
mXML = parsePath(nsDependentCString(filename), mObserver);
|
||||
return mXML ? 0 : 1;
|
||||
}
|
||||
int openOutput (char * outputFilename)
|
||||
{
|
||||
mOut = new ofstream(outputFilename);
|
||||
return mXML ? 0 : 1;
|
||||
}
|
||||
int runTransform ()
|
||||
{
|
||||
if (!mXML || !mStylesheet || !mOut)
|
||||
return 1;
|
||||
nsresult rv = transform(*mXML, mStylesheet, *mOut, mObserver);
|
||||
return NS_FAILED(rv);
|
||||
}
|
||||
int closeOutput ()
|
||||
{
|
||||
if (mOut)
|
||||
mOut->close();
|
||||
delete mOut;
|
||||
mOut = 0;
|
||||
return 0;
|
||||
}
|
||||
int terminate()
|
||||
{
|
||||
delete mXML;
|
||||
mXML = 0;
|
||||
if (mOut && mOut->is_open())
|
||||
mOut->close();
|
||||
delete mOut;
|
||||
mOut = 0;
|
||||
mStylesheet = 0;
|
||||
return 0;
|
||||
}
|
||||
~txDriverProcessor()
|
||||
{
|
||||
delete mXML;
|
||||
delete mOut;
|
||||
}
|
||||
private:
|
||||
txXPathNode *mXML;
|
||||
nsRefPtr<txStylesheet> mStylesheet;
|
||||
SimpleErrorObserver mObserver;
|
||||
ofstream* mOut;
|
||||
};
|
||||
|
||||
int main (int argc, char ** argv)
|
||||
{
|
||||
txDriverProcessor driver;
|
||||
#ifdef MOZ_JPROF
|
||||
setupProfilingStuff();
|
||||
#endif
|
||||
NS_InitXPCOM2(nsnull, nsnull, nsnull);
|
||||
if (!txDriverProcessor::init())
|
||||
return 1;
|
||||
driver.main (argc, argv);
|
||||
txDriverProcessor::shutdown();
|
||||
NS_ShutdownXPCOM(nsnull);
|
||||
return 0;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user