mirror of https://github.com/BOINC/boinc.git
1326 lines
53 KiB
Plaintext
1326 lines
53 KiB
Plaintext
|
<HTML>
|
||
|
<HEAD>
|
||
|
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="TEXT/HTML; CHARSET=UTF-8">
|
||
|
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="TEXT/HTML" CHARSET="UTF-8">
|
||
|
<META HTTP-EQUIV="CONTENT-STYLE-TYPE" CONTENT="TEXT/CSS">
|
||
|
<STYLE TYPE="TEXT/CSS" MEDIA="SCREEN">
|
||
|
BODY, H2, H3, H4, P, UL, OL, DL
|
||
|
{
|
||
|
FONT-FAMILY: "VERDANA", "HELVETICA", "ARIAL", "SANS-SERIF"
|
||
|
}
|
||
|
|
||
|
H1 {COLOR: #0058A0; FONT-SIZE: 20PT}
|
||
|
H2 {COLOR: #0058A0; FONT-SIZE: 16PT}
|
||
|
H3 {COLOR: #0058A0; FONT-SIZE: 14PT}
|
||
|
H4 {COLOR: #0058A0; FONT-SIZE: 12PT}
|
||
|
|
||
|
A:LINK, A:ACTIVE, A:VISITED
|
||
|
{
|
||
|
COLOR: #0058A0;
|
||
|
TEXT-DECORATION: NONE
|
||
|
}
|
||
|
|
||
|
P, UL, OL, DL {MARGIN-LEFT: 10%; MARGIN-RIGHT: 10%; FONT-SIZE: 10PT}
|
||
|
DT {MARGIN-BOTTOM: 0.5EM}
|
||
|
.OFFSET {MARGIN-LEFT: 10%}
|
||
|
.AFTERSKIP {MARGIN-BOTTOM: 1EM}
|
||
|
.AFTERHALF {MARGIN-BOTTOM: 0.5EM}
|
||
|
.EXAMPLE {MARGIN-LEFT: 10%; MARGIN-RIGHT: 10%;
|
||
|
BORDER-COLOR: #0058A0; BORDER-STYLE:SOLID; BORDER-WIDTH: 1PT; PADDING: 1PT}
|
||
|
CODE {FONT-FAMILY: "COURIER"}
|
||
|
.COMMENT {COLOR: #0000FF}
|
||
|
|
||
|
P.OFFSET {MARGIN-LEFT: 15%}
|
||
|
P.INNER {MARGIN-LEFT: 2%; WIDTH: 96%}
|
||
|
P.NOTE {MARGIN-LEFT: 10%; BORDER-COLOR: #0058A0;
|
||
|
BORDER-STYLE:SOLID; BORDER-WIDTH: 1PT;
|
||
|
PADDING: 5PT; BACKGROUND-COLOR:#E0E0E0 }
|
||
|
|
||
|
PRE {FONT-SIZE: 10PT; PADDING: 5PT}
|
||
|
|
||
|
</STYLE>
|
||
|
<TITLE>GADOC - SABLOTRON 0.60</TITLE>
|
||
|
</HEAD>
|
||
|
<BODY BGCOLOR="#FFFFFF">
|
||
|
<H1 CLASS="AFTERSKIP">SABLOTRON 0.60</H1>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<P>
|
||
|
<B>
|
||
|
<I>TOM KAISER (GINGER ALLIANCE)</I>
|
||
|
</B>
|
||
|
</P>
|
||
|
<P>
|
||
|
<I>JUNE 17, 2001</I>
|
||
|
</P>
|
||
|
</DIV>
|
||
|
<H3>ABSTRACT</H3>
|
||
|
<DIV CLASS="OFFSET">THIS IS A DESCRIPTION OF THE CURRENT VERSION OF THE
|
||
|
XSLT PROCESSOR CALLED SABLOTRON, INCLUDING AN OVERVIEW OF ITS
|
||
|
LIMITATIONS AS COMPARED TO THE XSLT SPECIFICATION.
|
||
|
</DIV>
|
||
|
<H3>CONTENTS</H3>
|
||
|
<DIV STYLE="MARGIN-LEFT: 10%; MARGIN-BOTTOM: 2EM; FONT-SIZE: SMALLER">
|
||
|
<SPAN CLASS="AFTERHALF">
|
||
|
<A NAME="TOC_I__25"></A>&NBSP;<A HREF="#I__25">
|
||
|
<B>1&NBSP;&NBSP;THIS TEXT</B>
|
||
|
</A>
|
||
|
<DIV CLASS="OFFSET"></DIV>
|
||
|
</SPAN>
|
||
|
<SPAN CLASS="AFTERHALF">
|
||
|
<A NAME="TOC_I__60"></A>&NBSP;<A HREF="#I__60">
|
||
|
<B>2&NBSP;&NBSP;CHANGES FROM THE LAST RELEASE</B>
|
||
|
</A>
|
||
|
<DIV CLASS="OFFSET"></DIV>
|
||
|
</SPAN>
|
||
|
<SPAN CLASS="AFTERHALF">
|
||
|
<A NAME="TOC_I__74"></A>&NBSP;<A HREF="#I__74">
|
||
|
<B>3&NBSP;&NBSP;INTRODUCTION</B>
|
||
|
</A>
|
||
|
<DIV CLASS="OFFSET">&NBSP;&NBSP;<A HREF="#I__81">3.1&NBSP;&NBSP;XSLT</A>
|
||
|
<BR>&NBSP;&NBSP;<A HREF="#I__154">3.2&NBSP;&NBSP;ON SABLOTRON</A>
|
||
|
<BR>
|
||
|
</DIV>
|
||
|
</SPAN>
|
||
|
<SPAN CLASS="AFTERHALF">
|
||
|
<A NAME="TOC_I__227"></A>&NBSP;<A HREF="#I__227">
|
||
|
<B>4&NBSP;&NBSP;THE SOURCES</B>
|
||
|
</A>
|
||
|
<DIV CLASS="OFFSET">&NBSP;&NBSP;<A HREF="#I__238">4.1&NBSP;&NBSP;GETTING THE SOURCES</A>
|
||
|
<BR>&NBSP;&NBSP;<A HREF="#I__280">4.2&NBSP;&NBSP;JOINING THE DEVELOPMENT</A>
|
||
|
<BR>
|
||
|
</DIV>
|
||
|
</SPAN>
|
||
|
<SPAN CLASS="AFTERHALF">
|
||
|
<A NAME="TOC_I__305"></A>&NBSP;<A HREF="#I__305">
|
||
|
<B>5&NBSP;&NBSP;IMPLEMENTATION. SUPPORTED INSTRUCTIONS AND FUNCTIONS</B>
|
||
|
</A>
|
||
|
<DIV CLASS="OFFSET">&NBSP;&NBSP;<A HREF="#I__343">5.1&NBSP;&NBSP;TEMPLATES</A>
|
||
|
<BR>&NBSP;&NBSP;<A HREF="#I__364">5.2&NBSP;&NBSP;CONDITIONAL PROCESSING</A>
|
||
|
<BR>&NBSP;&NBSP;<A HREF="#I__381">5.3&NBSP;&NBSP;LOOPS</A>
|
||
|
<BR>&NBSP;&NBSP;<A HREF="#I__398">5.4&NBSP;&NBSP;VARIABLES AND PARAMETERS</A>
|
||
|
<BR>&NBSP;&NBSP;<A HREF="#I__415">5.5&NBSP;&NBSP;ELEMENT CREATION</A>
|
||
|
<BR>&NBSP;&NBSP;<A HREF="#I__439">5.6&NBSP;&NBSP;GLOBAL DEFINITIONS</A>
|
||
|
<BR>&NBSP;&NBSP;<A HREF="#I__476">5.7&NBSP;&NBSP;VALUES AND COPYING</A>
|
||
|
<BR>&NBSP;&NBSP;<A HREF="#I__508">5.8&NBSP;&NBSP;NAMESPACE PROCESSING</A>
|
||
|
<BR>&NBSP;&NBSP;<A HREF="#I__529">5.9&NBSP;&NBSP;SORTING</A>
|
||
|
<BR>&NBSP;<A HREF="#I__577">5.10&NBSP;&NBSP;WHITESPACE STRIPPING</A>
|
||
|
<BR>&NBSP;<A HREF="#I__598">5.11&NBSP;&NBSP;INCLUDES</A>
|
||
|
<BR>&NBSP;<A HREF="#I__623">5.12&NBSP;&NBSP;OTHER UNIMPLEMENTED INSTRUCTIONS</A>
|
||
|
<BR>&NBSP;<A HREF="#I__654">5.13&NBSP;&NBSP;OUTPUT CONFORMANCE</A>
|
||
|
<BR>&NBSP;<A HREF="#I__686">5.14&NBSP;&NBSP;XPATH EXPRESSIONS</A>
|
||
|
<BR>&NBSP;<A HREF="#I__714">5.15&NBSP;&NBSP;BUILT-IN FUNCTIONS</A>
|
||
|
<BR>
|
||
|
</DIV>
|
||
|
</SPAN>
|
||
|
<SPAN CLASS="AFTERHALF">
|
||
|
<A NAME="TOC_I__804"></A>&NBSP;<A HREF="#I__804">
|
||
|
<B>6&NBSP;&NBSP;OTHER IMPLEMENTATION-RELATED NOTES</B>
|
||
|
</A>
|
||
|
<DIV CLASS="OFFSET">&NBSP;&NBSP;<A HREF="#I__811">6.1&NBSP;&NBSP;HANDLERS</A>
|
||
|
<BR>&NBSP;&NBSP;<A HREF="#I__859">6.2&NBSP;&NBSP;ENCODINGS</A>
|
||
|
<BR>&NBSP;&NBSP;<A HREF="#I__887">6.3&NBSP;&NBSP;OUTPUT METHODS</A>
|
||
|
<BR>&NBSP;&NBSP;<A HREF="#I__915">6.4&NBSP;&NBSP;URIS</A>
|
||
|
<BR>&NBSP;&NBSP;<A HREF="#I__983">6.5&NBSP;&NBSP;NAMED BUFFERS</A>
|
||
|
<BR>&NBSP;&NBSP;<A HREF="#I__1015">6.6&NBSP;&NBSP;ERROR AND LOG MESSAGES</A>
|
||
|
<BR>
|
||
|
</DIV>
|
||
|
</SPAN>
|
||
|
<SPAN CLASS="AFTERHALF">
|
||
|
<A NAME="TOC_I__1048"></A>&NBSP;<A HREF="#I__1048">
|
||
|
<B>7&NBSP;&NBSP;THE C INTERFACE</B>
|
||
|
</A>
|
||
|
<DIV CLASS="OFFSET">&NBSP;&NBSP;<A HREF="#I__1065">7.1&NBSP;&NBSP;SHORTCUTS</A>
|
||
|
<BR>&NBSP;&NBSP;<A HREF="#I__1205">7.2&NBSP;&NBSP;BASIC FUNCTIONS</A>
|
||
|
<BR>&NBSP;&NBSP;<A HREF="#I__1416">7.3&NBSP;&NBSP;GENERALIZED INTERFACE FUNCTIONS</A>
|
||
|
<BR>&NBSP;&NBSP;<A HREF="#I__1578">7.4&NBSP;&NBSP;THE SITUATION OBJECT</A>
|
||
|
<BR>&NBSP;&NBSP;<A HREF="#I__1631">7.5&NBSP;&NBSP;DOCUMENT OBJECT MODEL (DOM) FUNCTIONS</A>
|
||
|
<BR>
|
||
|
</DIV>
|
||
|
</SPAN>
|
||
|
<SPAN CLASS="AFTERHALF">
|
||
|
<A NAME="TOC_I__1870"></A>&NBSP;<A HREF="#I__1870">
|
||
|
<B>8&NBSP;&NBSP;THE COMMAND LINE INTERFACE</B>
|
||
|
</A>
|
||
|
<DIV CLASS="OFFSET"></DIV>
|
||
|
</SPAN>
|
||
|
<SPAN CLASS="AFTERHALF">
|
||
|
<A NAME="TOC_I__2013"></A>&NBSP;<A HREF="#I__2013">
|
||
|
<B>9&NBSP;&NBSP;REFERENCES</B>
|
||
|
</A>
|
||
|
<DIV CLASS="OFFSET"></DIV>
|
||
|
</SPAN>
|
||
|
</DIV>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<A NAME="I__25"></A>
|
||
|
<H2>
|
||
|
<A HREF="#TOC_I__25">1&NBSP;&NBSP;THIS TEXT</A>
|
||
|
</H2>
|
||
|
<DIV>
|
||
|
<P CLASS="">THE HTML FORM OF THIS DESCRIPTION
|
||
|
WAS COMPILED BY SABLOTRON FROM THE XML SOURCE
|
||
|
SABLOT-0-60.XML.
|
||
|
</P>
|
||
|
<P CLASS="">
|
||
|
THE MATERIAL IN THE FOLLOWING SECTIONS INCLUDES:
|
||
|
</P>
|
||
|
<UL>
|
||
|
<LI>SOME BACKGROUND INFORMATION ON XSLT AND SABLOTRON,</LI>
|
||
|
<LI>A DETAILED COMPARISON OF THE CURRENT VERSION OF
|
||
|
SABLOTRON TO THE XSLT SPEC,</LI>
|
||
|
<LI>SABLOTRON USAGE FROM THE COMMAND LINE OR AS A
|
||
|
LIBRARY.</LI>
|
||
|
</UL>
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<A NAME="I__60"></A>
|
||
|
<H2>
|
||
|
<A HREF="#TOC_I__60">2&NBSP;&NBSP;CHANGES FROM THE LAST RELEASE</A>
|
||
|
</H2>
|
||
|
<DIV>
|
||
|
<P CLASS="">PLEASE SEE THE RELEASE FILE.</P>
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<A NAME="I__74"></A>
|
||
|
<H2>
|
||
|
<A HREF="#TOC_I__74">3&NBSP;&NBSP;INTRODUCTION</A>
|
||
|
</H2>
|
||
|
<DIV>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<A NAME="I__81"></A>
|
||
|
<H3>
|
||
|
<A HREF="#TOC_I__74">3.1&NBSP;&NBSP;XSLT</A>
|
||
|
</H3>
|
||
|
<P CLASS="">XSLT IS A LANGUAGE ALLOWING TO TRANSFORM GIVEN XML DATA (THE
|
||
|
<I>INPUT</I>) ACCORDING TO A <I>STYLESHEET</I>. XSLT STYLESHEETS
|
||
|
ARE THEMSELVES XML DOCUMENTS; THAT IS, ALL INSTRUCTIONS OF THE
|
||
|
LANGUAGE ARE EXPRESSED IN THE FORM OF XML ELEMENTS. THE
|
||
|
<I>OUTPUT</I>, I.E. THE RESULT OF THE PROCESSING, IS TYPICALLY A
|
||
|
XML DOCUMENT AS WELL, ALTHOUGH THE SYNTACTIC REQUIREMENTS CAN BE
|
||
|
RELAXED TO ALLOW THE CREATION OF A HTML DOCUMENT (ONE THAT
|
||
|
CONTAINS UNCLOSED TAGS AND THE LIKE), OR EVEN PLAIN TEXT.
|
||
|
</P>
|
||
|
<P CLASS="">XSLT WAS DESIGNED BY THE WORLD WIDE WEB CONSORTIUM (W3C) AS
|
||
|
A PART OF THE XSL STYLESHEET LANGUAGE, WHERE IT IS COMPLEMENTED
|
||
|
BY A POWERFUL SET OF FORMATTING INSTRUCTIONS. THE MOST PRECISE
|
||
|
INFORMATION ABOUT XSLT CAN BE FOUND IN THE W3C RECOMMENDATION <A HREF="#REF-XSLT">[XSLT]</A>. IN PARTICULAR, APPENDIX B OF THE
|
||
|
RECOMMENDATION CONTAINS A HANDY SYNTAX TABLE. A GOOD TUTORIAL IS
|
||
|
<A HREF="#REF-BIBLE">[XMLBIBLE14]</A>.
|
||
|
</P>
|
||
|
<P CLASS="">OTHER W3C RECOMMENDATIONS ONE OFTEN NEEDS TO CONSULT ARE <A HREF="#REF-XML">[XML]</A> (FOR THE DEFINITION OF THE XML
|
||
|
LANGUAGE) AND <A HREF="#REF-XPATH">[XPATH]</A> (FOR DETAILS ON
|
||
|
XPATH, THE LANGUAGE USED TO FORM EXPRESSIONS IN XSLT AND
|
||
|
ELSEWHERE).
|
||
|
</P>
|
||
|
<P CLASS="">AN EXCELLENT SOURCE OF INFORMATION ABOUT XSLT (INDEED, ABOUT
|
||
|
ANYTHING RELATED TO XML AND SGML) IS <A HREF="#REF-RCOVER">[COVER]</A>; SEE ALSO <A HREF="#REF-XSLINFO">[XSLINFO]</A> AND <A HREF="#REF-XMLORG">[XMLORG]</A>.
|
||
|
</P>
|
||
|
</DIV>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<A NAME="I__154"></A>
|
||
|
<H3>
|
||
|
<A HREF="#TOC_I__74">3.2&NBSP;&NBSP;ON SABLOTRON</A>
|
||
|
</H3>
|
||
|
<P CLASS="">SABLOTRON IS A XSLT PROCESSOR (THOUGH NOT QUITE CONFORMING
|
||
|
YET..., SEE BELOW) WRITTEN IN C++. SINCE THE MACHINES WHERE IT
|
||
|
IS MEANT TO RUN INCLUDE VARIOUS SMALL MOBILE
|
||
|
CLIENTS, THE MAIN OBJECTIVES OF ITS DESIGN ARE THE FOLLOWING:
|
||
|
</P>
|
||
|
<UL>
|
||
|
<LI>PORTABILITY,</LI>
|
||
|
<LI>COMPACT CODE,</LI>
|
||
|
<LI>AS MUCH INDEPENDENCE ON OTHER RESOURCES (JAVA ETC.) AS
|
||
|
POSSIBLE.</LI>
|
||
|
</UL>
|
||
|
<P CLASS="">SABLOTRON IS A SINGLE SHARED LIBRARY
|
||
|
(<CODE>SABLOT.DLL</CODE> OR <CODE>LIBSABLOT.SO.0.60</CODE>). IT CAN
|
||
|
ALSO BE USED FROM THE COMMAND LINE VIA THE SIMPLE INTERFACE
|
||
|
CALLED <CODE>SABCMD</CODE>. SEE <A HREF="#INVOCATION">HERE</A> FOR
|
||
|
MORE INFORMATION.
|
||
|
</P>
|
||
|
<P CLASS="">THE ONLY SOFTWARE SABLOTRON RELIES ON IS <B>EXPAT</B>, THE
|
||
|
XML PARSER BY JAMES CLARK. SEE <A HREF="#EXPAT">BELOW</A> FOR
|
||
|
INFORMATION ON HOW TO GET EXPAT.
|
||
|
</P>
|
||
|
<P CLASS="">FOR INFORMATION ON THE AVAILABLE INTERFACES, E.G. FOR
|
||
|
PYTHON, PERL AND PHP, SEE <A HREF="HTTP://WWW.GINGERALL.COM">WWW.GINGERALL.COM</A>.
|
||
|
</P>
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<A NAME="I__227"></A>
|
||
|
<H2>
|
||
|
<A HREF="#TOC_I__227">4&NBSP;&NBSP;THE SOURCES</A>
|
||
|
</H2>
|
||
|
<DIV>
|
||
|
<P CLASS="">
|
||
|
SABLOTRON IS WRITTEN IN C++. THE SOURCE FILES COMPILE UNDER
|
||
|
WIN32 (USING MS VISUAL C++ 6.0) AND ON SOLARIS AND LINUX (USING
|
||
|
G++ 2.95.2) WITHOUT CHANGE.</P>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<A NAME="I__238"></A>
|
||
|
<H3>
|
||
|
<A HREF="#TOC_I__227">4.1&NBSP;&NBSP;GETTING THE SOURCES</A>
|
||
|
</H3>
|
||
|
<P CLASS="">THE SOURCE OR BINARY DISTRIBUTIONS OF SABLOTRON CAN BE DOWNLOADED
|
||
|
FROM <A HREF="HTTP://WWW.GINGERALL.COM">WWW.GINGERALL.COM</A>. FOR
|
||
|
INSTRUCTIONS ON HOW TO BUILD THE SOURCES (IF ANY), REFER TO THE ACCOMPANYING INSTALL FILE.
|
||
|
</P>
|
||
|
<P CLASS="">IF YOU HAVE ACCESS TO THE GINGER ALLIANCE CVS SERVER, YOU
|
||
|
CAN GET THE WORKING VERSION OF SABLOTRON IN THE CVS MODULE
|
||
|
<CODE>GA</CODE>. THE ACCESS RIGHTS CAN BE OBTAINED ON
|
||
|
REQUEST FROM <A HREF="MAILTO:CVSADMIN@GINGERALL.COM">THE CVS ADMIN</A>.
|
||
|
</P>
|
||
|
<P CLASS="">
|
||
|
<A NAME="EXPAT"></A>
|
||
|
SINCE VERSION 0.50, SABLOTRON USES EXPAT 1.95.1, AVAILABLE FROM <A HREF="HTTP://EXPAT.SOURCEFORGE.ORG">SOURCEFORGE</A>.
|
||
|
</P>
|
||
|
</DIV>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<A NAME="I__280"></A>
|
||
|
<H3>
|
||
|
<A HREF="#TOC_I__227">4.2&NBSP;&NBSP;JOINING THE DEVELOPMENT</A>
|
||
|
</H3>
|
||
|
<P CLASS="">
|
||
|
SABLOTRON IS AN OPEN SOURCE PROJECT AND ALL VOLUNTEERS ARE MOST
|
||
|
WELCOME! THE DOCUMENTATION OF THE SOURCES IS STILL SOMEWHAT
|
||
|
SPARSE BUT WE WILL TRY TO IMPROVE IT. IF YOU FIND THE INVITATION
|
||
|
TO WORK ON SABLOTRON WITH US INTERESTING, PLEASE <A HREF="MAILTO:SABLOTRON@GINGERALL.COM">CONTACT US</A>. THERE IS ALSO
|
||
|
A MAILING LIST AVAILABLE, SEE <A HREF="HTTP://WWW.GINGERALL.COM">WWW.GINGERALL.COM</A>.
|
||
|
</P>
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<A NAME="I__305"></A>
|
||
|
<H2>
|
||
|
<A HREF="#TOC_I__305">5&NBSP;&NBSP;IMPLEMENTATION. SUPPORTED INSTRUCTIONS AND FUNCTIONS</A>
|
||
|
</H2>
|
||
|
<DIV>
|
||
|
<P CLASS="">THE INSTRUCTION SET SUPPORTED BY THIS VERSION OF SABLOTRON IS
|
||
|
ALREADY SUFFICIENT FOR MANY TRANSFORMATION TASKS (E.G. THE TASK OF
|
||
|
FORMATTING THIS DOCUMENT). ON THE OTHER
|
||
|
HAND, A COMPARISON OF IT TO THE XSLT SPECIFICATION <A HREF="#REF-XSLT">[XSLT]</A> SHOWS THAT MUCH IS STILL TO BE
|
||
|
DONE. THE PURPOSE OF THE
|
||
|
FOLLOWING SECTIONS IS TO DESCRIBE THE VARYING DEGREE OF SUPPORT
|
||
|
FOR THE ELEMENTS OF THE XSLT LANGUAGE. </P>
|
||
|
<P CLASS="">IT MAY BE HELPFUL TO REFER TO THE SYNTAX TABLE IN APPENDIX B
|
||
|
OF <A HREF="#REF-XSLT">[XSLT]</A>. THE INSTRUCTIONS/ATTRIBUTES THAT
|
||
|
ARE NOT LISTED AS UNSUPPORTED SHOULD BE IMPLEMENTED. THE <A HREF="MAILTO:SABLOTRON@GINGERALL.COM">AUTHORS</A> WILL APPRECIATE BEING
|
||
|
TOLD ABOUT ANY OMISSIONS FOUND IN THE FOLLOWING
|
||
|
DESCRIPTION.</P>
|
||
|
<P CLASS="">FOR READABILITY, I SOMETIMES OMIT THE <CODE>XSL:</CODE> PREFIX
|
||
|
FROM THE INSTRUCTION NAMES.</P>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<A NAME="I__343"></A>
|
||
|
<H3>
|
||
|
<A HREF="#TOC_I__305">5.1&NBSP;&NBSP;TEMPLATES</A>
|
||
|
</H3>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>
|
||
|
TEMPLATE, APPLY-TEMPLATES, CALL-TEMPLATE
|
||
|
</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">
|
||
|
FULLY IMPLEMENTED. <CODE>XSL:SORT</CODE> IS SUPPORTED SINCE RELEASE 0.50.
|
||
|
</P>
|
||
|
</DIV>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<A NAME="I__364"></A>
|
||
|
<H3>
|
||
|
<A HREF="#TOC_I__305">5.2&NBSP;&NBSP;CONDITIONAL PROCESSING</A>
|
||
|
</H3>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>
|
||
|
IF, CHOOSE, WHEN, OTHERWISE
|
||
|
</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">FULLY IMPLEMENTED.
|
||
|
</P>
|
||
|
</DIV>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<A NAME="I__381"></A>
|
||
|
<H3>
|
||
|
<A HREF="#TOC_I__305">5.3&NBSP;&NBSP;LOOPS</A>
|
||
|
</H3>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>FOR-EACH</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">FULLY IMPLEMENTED.
|
||
|
</P>
|
||
|
</DIV>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<A NAME="I__398"></A>
|
||
|
<H3>
|
||
|
<A HREF="#TOC_I__305">5.4&NBSP;&NBSP;VARIABLES AND PARAMETERS</A>
|
||
|
</H3>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>VARIABLE, PARAM, WITH-PARAM</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">FULLY IMPLEMENTED. TOP-LEVEL VARIABLES AND PARAMETERS ARE
|
||
|
READ IN THE DOCUMENT ORDER, SO NO FORWARD REFERENCES ARE
|
||
|
RESOLVED. THIS IS A MINOR DEVIATION FROM THE SPEC. </P>
|
||
|
</DIV>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<A NAME="I__415"></A>
|
||
|
<H3>
|
||
|
<A HREF="#TOC_I__305">5.5&NBSP;&NBSP;ELEMENT CREATION</A>
|
||
|
</H3>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>ELEMENT, ATTRIBUTE, TEXT,
|
||
|
COMMENT, PROCESSING-INSTRUCTION, ATTRIBUTE-SET</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">
|
||
|
<CODE>XSL:ATTRIBUTE-SET</CODE> IS NOT IMPLEMENTED. FOR THE
|
||
|
REST, <CODE>NAME</CODE> IS THE ONLY RECOGNIZED ATTRIBUTE (WHERE
|
||
|
APPLICABLE). LITERAL RESULT ELEMENTS WORK.</P>
|
||
|
</DIV>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<A NAME="I__439"></A>
|
||
|
<H3>
|
||
|
<A HREF="#TOC_I__305">5.6&NBSP;&NBSP;GLOBAL DEFINITIONS</A>
|
||
|
</H3>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>STYLESHEET, TRANSFORM, OUTPUT</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">FOR <CODE>STYLESHEET</CODE> AND <CODE>TRANSFORM</CODE>,
|
||
|
THE ONLY RECOGNIZED ATTRIBUTE IS
|
||
|
<CODE>VERSION</CODE>. <CODE>XSL:OUTPUT</CODE> SHOULD WORK
|
||
|
(SEE BELOW FOR NOTES ON THE <CODE>ENCODING</CODE>
|
||
|
ATTRIBUTE). HTML INDENTATION HAS BEEN ADDED IN 0.60.
|
||
|
</P>
|
||
|
</DIV>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<A NAME="I__476"></A>
|
||
|
<H3>
|
||
|
<A HREF="#TOC_I__305">5.7&NBSP;&NBSP;VALUES AND COPYING</A>
|
||
|
</H3>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>VALUE-OF, COPY, COPY-OF</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">
|
||
|
<CODE>COPY-OF</CODE> AND <CODE>VALUE-OF</CODE> ARE FULLY
|
||
|
IMPLEMENTED. <CODE>COPY</CODE> IS IMPLEMENTED EXCEPT FOR THE
|
||
|
<CODE>USE-ATTRIBUTE-SETS</CODE> ATTRIBUTE.</P>
|
||
|
</DIV>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<A NAME="I__508"></A>
|
||
|
<H3>
|
||
|
<A HREF="#TOC_I__305">5.8&NBSP;&NBSP;NAMESPACE PROCESSING</A>
|
||
|
</H3>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>NAMESPACE-ALIAS</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">NAMESPACES SHOULD BE PROCESSED CORRECTLY. THE
|
||
|
<CODE>NAMESPACE-ALIAS</CODE> INSTRUCTION IS NOW SUPPORTED
|
||
|
(PATCH BY MAJOR).</P>
|
||
|
</DIV>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<A NAME="I__529"></A>
|
||
|
<H3>
|
||
|
<A HREF="#TOC_I__305">5.9&NBSP;&NBSP;SORTING</A>
|
||
|
</H3>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>SORT</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">
|
||
|
<CODE>XSL:SORT</CODE> IS IMPLEMENTED SINCE 0.50. THERE ARE
|
||
|
MINOR LIMITATIONS:
|
||
|
</P>
|
||
|
<UL>
|
||
|
<LI>CURRENTLY, THE <CODE>LANG</CODE> ATTRIBUTE MAY ONLY
|
||
|
CONTAIN THE VALUES <CODE>"EN"</CODE> OR <CODE>"CZ"</CODE>.</LI>
|
||
|
<LI>
|
||
|
<CODE>CASE-ORDER</CODE> CANNOT BE SPECIFIED.</LI>
|
||
|
</UL>
|
||
|
</DIV>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<A NAME="I__577"></A>
|
||
|
<H3>
|
||
|
<A HREF="#TOC_I__305">5.10&NBSP;&NBSP;WHITESPACE STRIPPING</A>
|
||
|
</H3>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>STRIP-SPACE, PRESERVE-SPACE</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">ONLY THE DEFAULT WHITESPACE STRIPPING IS DONE. THAT IS,
|
||
|
ALL WHITESPACE-ONLY TEXT NODES IN ANY STYLESHEET, NOT APPEARING
|
||
|
INSIDE A <CODE>XSL:TEXT</CODE>, ARE REMOVED. THE TWO
|
||
|
INSTRUCTIONS FOR WHITESPACE STRIPPING AND PRESERVATION ARE
|
||
|
UNSUPPORTED.</P>
|
||
|
</DIV>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<A NAME="I__598"></A>
|
||
|
<H3>
|
||
|
<A HREF="#TOC_I__305">5.11&NBSP;&NBSP;INCLUDES</A>
|
||
|
</H3>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>INCLUDE, IMPORT, APPLY-IMPORTS</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">ONLY <CODE>XSL:INCLUDE</CODE> IS IMPLEMENTED. PROCESSING
|
||
|
INVOLVING MULTIPLE DOCUMENTS WORKS, BUT HAS TO GET MORE TESTING,
|
||
|
EG. WITH RESPECT TO <CODE>GENERATE-ID()</CODE>.</P>
|
||
|
</DIV>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<A NAME="I__623"></A>
|
||
|
<H3>
|
||
|
<A HREF="#TOC_I__305">5.12&NBSP;&NBSP;OTHER UNIMPLEMENTED INSTRUCTIONS</A>
|
||
|
</H3>
|
||
|
<UL>
|
||
|
<LI>
|
||
|
<CODE>XSL:KEY,</CODE>
|
||
|
</LI>
|
||
|
<LI>
|
||
|
<CODE>XSL:NUMBER,</CODE>
|
||
|
</LI>
|
||
|
<LI>
|
||
|
<CODE>XSL:FALLBACK.</CODE>
|
||
|
</LI>
|
||
|
</UL>
|
||
|
</DIV>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<A NAME="I__654"></A>
|
||
|
<H3>
|
||
|
<A HREF="#TOC_I__305">5.13&NBSP;&NBSP;OUTPUT CONFORMANCE</A>
|
||
|
</H3>
|
||
|
<P CLASS="">THE OUTPUT MECHANISM IS MUCH CLOSER TO THE SPEC THAN IN
|
||
|
THE VERSIONS PRIOR TO 0.4. THE FOLLOWING ISSUES REMAIN FOR THE
|
||
|
HTML METHOD:</P>
|
||
|
<UL>
|
||
|
<LI>OUTPUT THE BOOLEAN ATTRIBUTES CORRECTLY.</LI>
|
||
|
<LI>DISABLE THE ESCAPING INSIDE
|
||
|
<CODE><SCRIPT></CODE> AND
|
||
|
<CODE><STYLE></CODE>
|
||
|
</LI>.
|
||
|
</UL>
|
||
|
</DIV>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<A NAME="I__686"></A>
|
||
|
<H3>
|
||
|
<A HREF="#TOC_I__305">5.14&NBSP;&NBSP;XPATH EXPRESSIONS</A>
|
||
|
</H3>
|
||
|
<P CLASS="">ALMOST ALL FEATURES OF XPATH ARE FULLY IMPLEMENTED. THIS MEANS
|
||
|
THERE SHOULD BE NO PROBLEMS WITH EXPRESSIONS OF ANY KIND.</P>
|
||
|
<P CLASS="">ONE EXCEPTION RELATES TO AXES. THE <CODE>FOLLOWING</CODE> AND
|
||
|
<CODE>PRECEDING</CODE> AXES HAVEN'T BEEN IMPLEMENTED YET.</P>
|
||
|
<P CLASS="">ANOTHER POSSIBLE EXCEPTION MAY BE NUMBERS; WE DID NOT YET DO A
|
||
|
THOROUGH TEST OF ROUNDING, NANS, INFINITY, ETC.</P>
|
||
|
</DIV>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<A NAME="I__714"></A>
|
||
|
<H3>
|
||
|
<A HREF="#TOC_I__305">5.15&NBSP;&NBSP;BUILT-IN FUNCTIONS</A>
|
||
|
</H3>
|
||
|
<P CLASS="">
|
||
|
<A NAME="CORELIB"></A>ONLY A FEW FUNCTIONS FROM THE STANDARD
|
||
|
FUNCTION LIBRARY REMAIN
|
||
|
UNIMPLEMENTED:
|
||
|
</P>
|
||
|
<UL>
|
||
|
<LI>
|
||
|
<CODE>ID()</CODE>,</LI>
|
||
|
<LI>
|
||
|
<CODE>LANG()</CODE> (ACCEPTED BUT ALWAYS RETURNS TRUE),</LI>
|
||
|
<LI>
|
||
|
<CODE>KEY()</CODE>,</LI>
|
||
|
<LI>
|
||
|
<CODE>FORMAT-NUMBER()</CODE>,</LI>
|
||
|
<LI>
|
||
|
<CODE>UNPARSED-ENTITY-URI()</CODE>.</LI>
|
||
|
</UL>
|
||
|
<P CLASS="">AS FOR THE FUCTIONS THAT <I>ARE</I> IMPLEMENTED, THE
|
||
|
FOLLOWING IS A LIST OF DIFFERENCES FROM THE SPEC:
|
||
|
</P>
|
||
|
<UL>
|
||
|
<LI>
|
||
|
<CODE>DOCUMENT()</CODE> ONLY ACCEPTS ONE ARGUMENT, ALWAYS
|
||
|
GETTING THE BASE URI FROM THE STYLESHEET URI.
|
||
|
</LI>
|
||
|
<LI>
|
||
|
<CODE>STRING-LENGTH()</CODE> RETURNS THE BYTE LENGTH OF
|
||
|
THE UTF-8 REPRESENTATION OF THE STRING. THIS WILL TYPICALLY
|
||
|
DIFFER FROM THE ACTUAL LENGTH.
|
||
|
</LI>
|
||
|
<LI>
|
||
|
<CODE>GENERATE-ID()</CODE> MIGHT FAIL TO GENERATE UNIQUE IDENTIFIERS
|
||
|
WHEN SEVERAL INPUT DOCUMENTS ARE PRESENT (GIVING THE SAME ID TO
|
||
|
NODES FROM DIFFERENT DOCUMENTS).
|
||
|
</LI>
|
||
|
</UL>
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<A NAME="I__804"></A>
|
||
|
<H2>
|
||
|
<A HREF="#TOC_I__804">6&NBSP;&NBSP;OTHER IMPLEMENTATION-RELATED NOTES</A>
|
||
|
</H2>
|
||
|
<DIV>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<A NAME="I__811"></A>
|
||
|
<H3>
|
||
|
<A HREF="#TOC_I__804">6.1&NBSP;&NBSP;HANDLERS</A>
|
||
|
</H3>
|
||
|
<P CLASS="">IT IS POSSIBLE FOR THE USER TO SUPPLY THE FOLLOWING
|
||
|
HANDLERS TO SABLOTRON:
|
||
|
<UL>
|
||
|
<LI>MESSAGE HANDLER (TO BYPASS THE DEFAULT WAY OF DISPLAYING
|
||
|
ERROR AND WARNING MESSAGES AND LOGGING),</LI>
|
||
|
<LI>SCHEME HANDLER (TO RETRIEVE DOCUMENTS WHOSE URI USE AN
|
||
|
UNSUPPORTED SCHEME),</LI>
|
||
|
<LI>STREAMING HANDLER (AN EXPAT-LIKE INTERFACE TO THE XML
|
||
|
DOCUMENT WHICH IS THE RESULT OF THE PROCESSING),</LI>
|
||
|
<LI>'MISCELLANEOUS' HANDLER (WHICH WILL PROBABLY SERVER AS A
|
||
|
COLLECTIONS OF ODD CALLBACKS).</LI>
|
||
|
</UL>
|
||
|
</P>
|
||
|
<P CLASS="">
|
||
|
THE HANDLERS ARE SET USING <CODE>SABLOTREGHANDLER()</CODE>
|
||
|
FOR DETAILS CONCERNING THE INTERFACE OF THESE HANDLERS,
|
||
|
CONSULT THE HEADER FILES <CODE>SABLOT.H</CODE> AND
|
||
|
<CODE>SHANDLER.H</CODE>.
|
||
|
</P>
|
||
|
</DIV>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<A NAME="I__859"></A>
|
||
|
<H3>
|
||
|
<A HREF="#TOC_I__804">6.2&NBSP;&NBSP;ENCODINGS</A>
|
||
|
</H3>
|
||
|
<P CLASS="">
|
||
|
IN VERSION 0.52, THE ENCODING CONVERSION CAPABILITIES OF
|
||
|
SABLOTRON HAVE BEEN MUCH EXTENDED. THE MOST IMPORTANT FACT IS THE
|
||
|
FOLLOWING: IF YOU HAVE THE ICONV LIBRARY INSTALLED ON YOUR SYSTEM, YOU
|
||
|
CAN USE ANY ENCODING IT SUPPORTS (THAT IS, ALMOST ANY ENCODING
|
||
|
WHATSOEVER) FOR BOTH THE INPUT AND THE OUTPUT DOCUMENTS. ICONV
|
||
|
IS AVAILABLE ON MOST SYSTEMS (IT IS A STANDARD PART OF GLIBC2,
|
||
|
FOR INSTANCE). THERE ARE IMPLEMENTATIONS FOR WIN32 AS WELL.
|
||
|
</P>
|
||
|
<P CLASS="">IF ICONV IS NOT AVAILABLE, THE ENCODING MAY STILL BE SUPPORTED INTERNALLY BY
|
||
|
SABLOTRON. AT PRESENT, THE LIST IS OF SUCH ENCODINGS IS RATHER
|
||
|
SHORT: BESIDES UTF-8, THESE ARE UTF-16, ASCII, ISO-8859-1,
|
||
|
ISO-8859-2 AND WINDOWS-1250 ON INPUT, NONE ON OUTPUT. HOWEVER,
|
||
|
WE PLAN TO IMPLEMENT A HALF INDEPENDENT LIGHT-WEIGHT
|
||
|
CONVERSION LIBRARY FOR USE ON SYSTEMS WITHOUT ICONV,
|
||
|
EXTENDING THE SET OF INTERNALLY SUPPORTED ENCODINGS
|
||
|
CONSIDERABLY.
|
||
|
</P>
|
||
|
<P CLASS="">LASTLY, THE USER HAS THE OPTION TO IMPLEMENT A CUSTOM
|
||
|
ENCODING CONVERSION HANDLER, WHICH WILL BE ASKED TO PERFORM ANY UNSUPPORTED
|
||
|
CONVERSION. SEE THE <CODE>SHANDLER.H</CODE> HEADER FILE FOR
|
||
|
DETAILS.
|
||
|
</P>
|
||
|
<P CLASS="">THE DEFAULT INPUT AND OUTPUT ENCODING IS IN ALL CASES UTF-8.</P>
|
||
|
</DIV>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<A NAME="I__887"></A>
|
||
|
<H3>
|
||
|
<A HREF="#TOC_I__804">6.3&NBSP;&NBSP;OUTPUT METHODS</A>
|
||
|
</H3>
|
||
|
<P CLASS="">IN ADDITION TO THE STANDARD OUTPUT METHODS (XML, HTML AND
|
||
|
TEXT), IT IS POSSIBLE TO OUTPUT XHTML. DOCUMENTS OUTPUT USING
|
||
|
THIS METHOD OBEY THE XHTML 1.0 RULES (IN PARTICULAR, ALL EMPTY
|
||
|
ELEMENTS ARE CLOSED). TO CHOOSE THE METHOD, USE
|
||
|
<CODE><XSL:OUTPUT METHOD='XHTML'></CODE>. <B>PLEASE NOTE</B>
|
||
|
THAT THE NAME OF THIS METHOD WILL POSSIBLY BE CHANGED SINCE THE XSLT
|
||
|
SPEC REQUIRES ANY PROCESSOR-SPECIFIC METHODS TO HAVE QUALIFIED
|
||
|
NAMES, SAY <CODE>SAB:XHTML</CODE>. ON THE OTHER HAND, THE NAME
|
||
|
<CODE>XHTML</CODE> IS CONSIDERED IN THE XSLT 2.0 WORKING DRAFT.</P>
|
||
|
</DIV>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<A NAME="I__915"></A>
|
||
|
<H3>
|
||
|
<A HREF="#TOC_I__804">6.4&NBSP;&NBSP;URIS</A>
|
||
|
</H3>
|
||
|
<P CLASS="">SABLOTRON CAN HANDLE
|
||
|
TWO URI SCHEMES NATIVELY: 'FILE' AND 'ARG' (SEE
|
||
|
BELOW). MOREOVER, IT IS POSSIBLE TO USE THE FUNCTION
|
||
|
<CODE>SABLOTREGSCHEMEHANDLER</CODE> TO REGISTER AN EXTERNAL SCHEME
|
||
|
HANDLER WHICH WILL RECEIVE REQUESTS IN ALL OTHER SCHEMES. SEE
|
||
|
THE DOCUMENTATION IN <CODE>SABLOT.H</CODE> AND
|
||
|
<CODE>SHANDLER.H</CODE>.
|
||
|
</P>
|
||
|
<P CLASS="">RELATIVE URI REFERENCES ARE RESOLVED IN CONFORMANCE TO RFC
|
||
|
2396. THE BASE URI IS WELL DEFINED WHEN THE RELATIVE REFERENCE APPEARS
|
||
|
INSIDE A XML DOCUMENT; WHEN INVOKING SABCMD, THE BASE URI IS
|
||
|
TAKEN TO CORRESPOND TO THE CURRENT WORKING DIRECTORY.
|
||
|
</P>
|
||
|
<P CLASS="">
|
||
|
<A NAME="FNAME-RULES"></A>WHEN SPECIFYING FILENAMES, THE
|
||
|
FOLLOWING RULES ARE IN EFFECT:
|
||
|
</P>
|
||
|
<UL>
|
||
|
<LI>SPECIFY THE "FILE:" SCHEME FOR ANY STANDARD FILES,
|
||
|
I.E. REFER TO <CODE>STDIN</CODE> AS <CODE>FILE://STDIN</CODE>
|
||
|
ETC.</LI>
|
||
|
<LI>SLASHES AND BACKSLASHES WORK EQUALLY FINE, IN WINDOWS AS
|
||
|
WELL AS LINUX.</LI>
|
||
|
<LI>TO INCLUDE A DRIVE LETTER UNDER WINDOWS
|
||
|
(E.G. <CODE>C:\DOC.XML</CODE>), IT IS NECESSARY TO SAY
|
||
|
<CODE>FILE://C:/DOC.XML</CODE>.
|
||
|
</LI>
|
||
|
</UL>
|
||
|
</DIV>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<A NAME="I__983"></A>
|
||
|
<H3>
|
||
|
<A HREF="#TOC_I__804">6.5&NBSP;&NBSP;NAMED BUFFERS</A>
|
||
|
</H3>
|
||
|
<P CLASS="">
|
||
|
<A NAME="ARGSCHEME"></A>SABLOTRON INTRODUCES AN URI SCHEME
|
||
|
'ARG:' WHICH ENABLES ONE TO USE STRINGS IN NAMED MEMORY
|
||
|
BUFFERS. THE BUFFER NAMES CAN HAVE A TREE-LIKE STRUCTURE SO THAT
|
||
|
A RELATIVE REFERENCE FROM A DOCUMENT IN A BUFFER CAN BE RESOLVED
|
||
|
AS POINTING TO ANOTHER BUFFER.
|
||
|
</P>
|
||
|
<P CLASS="">FOR INSTANCE, IF WE INVOKE SABLOTRON SPECIFYING THAT A
|
||
|
BUFFER NAMED <CODE>/MYBUF/1</CODE> CONTAINS THE STRING
|
||
|
"&LT;A>CONTENTS&LT;/A>", THEN THE EXPRESSION
|
||
|
</P>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>
|
||
|
DOCUMENT('ARG:/MYBUF/1')/A
|
||
|
</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">HAS STRING-VALUE "CONTENTS". IF THE DOCUMENT IN ARG:/MYBUF/1
|
||
|
CONTAINED A RELATIVE URI REFERENCE "../THEIRBUF/2" THEN THIS
|
||
|
WOULD BE RESOLVED AS POINTING TO "ARG:/THEIRBUF/2".</P>
|
||
|
</DIV>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<A NAME="I__1015"></A>
|
||
|
<H3>
|
||
|
<A HREF="#TOC_I__804">6.6&NBSP;&NBSP;ERROR AND LOG MESSAGES</A>
|
||
|
</H3>
|
||
|
<P CLASS="">BY DEFAULT, SABLOTRON WRITES ERROR AND WARNING MESSAGES TO
|
||
|
STDERR, AND DOES NO LOGGING. BY A CALL TO
|
||
|
<CODE>SABLOTSETLOG()</CODE>, YOU CAN SPECIFY THE NAME OF THE LOG
|
||
|
FILE TO BE USED.</P>
|
||
|
<P CLASS="">BESIDES, YOU CAN USE <CODE>SABLOTREGHANDLER()</CODE>
|
||
|
TO OVERRIDE THE DEFAULT MESSAGE HANDLING. THE HANDLER YOU
|
||
|
REGISTER WILL RECEIVE ALL MESSAGES IN A STRUCTURED FORM THAT'S
|
||
|
EASY TO PROCESS AND FILTER. FOR DETAILS, SEE
|
||
|
THE DOCUMENTATION IN <CODE>SABLOT.H</CODE> AND
|
||
|
<CODE>SHANDLER.H</CODE>.</P>
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<A NAME="I__1048"></A>
|
||
|
<H2>
|
||
|
<A HREF="#TOC_I__1048">7&NBSP;&NBSP;THE C INTERFACE</A>
|
||
|
</H2>
|
||
|
<DIV>
|
||
|
<P CLASS="">
|
||
|
<A NAME="INVOCATION"></A>
|
||
|
</P>
|
||
|
<P CLASS="">
|
||
|
THIS SECTION DESCRIBES THE FUNCTIONS EXPORTED FROM THE
|
||
|
SABLOTRON LIBRARY. ALL OF THEM HAVE A RETURN TYPE OF 'INT'
|
||
|
AND RETURN AN ERROR FLAG (NONZERO SIGNALS AN ERROR). ERRORS
|
||
|
ARE REPORTED TO THE USER BY SABLOTRON ITSELF.
|
||
|
</P>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<A NAME="I__1065"></A>
|
||
|
<H3>
|
||
|
<A HREF="#TOC_I__1048">7.1&NBSP;&NBSP;SHORTCUTS</A>
|
||
|
</H3>
|
||
|
<P CLASS="">
|
||
|
WE'LL FIRST DESCRIBE THE 'SHORTCUTS' THAT DO THE WHOLE
|
||
|
PROCESSING IN ONE CALL.
|
||
|
</P>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>
|
||
|
INT SABLOTPROCESS(CHAR *SHEETURI, CHAR *INPUTURI, CHAR *RESULTURI,
|
||
|
CHAR **PARAMS, CHAR **ARGUMENTS, CHAR **RESULTARG);
|
||
|
</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">
|
||
|
THIS IS THE BASIC FUNCTION. THE FIRST THREE OF ITS ARGUMENTS
|
||
|
ARE THE URIS OF THE XSLT STYLESHEET, THE XML SOURCE AND THE
|
||
|
RESULTING DOCUMENT, RESPECTIVELY. FOR SOME NOTES ON SPECIFYING
|
||
|
FILE NAMES, SEE <A HREF="#FNAME-RULES">ABOVE</A>.
|
||
|
</P>
|
||
|
<P CLASS="">
|
||
|
<CODE>PARAMS</CODE> IS AN ARRAY OF POINTERS TO THE NAMES
|
||
|
AND CONTENTS OF THE TOP-LEVEL STYLESHEET PARAMETERS. THUS,
|
||
|
<CODE>PARAMS[0]</CODE> IS A POINTER TO THE NULL-TERMINATED NAME
|
||
|
OF THE FIRST PARAMETER, <CODE>PARAMS[1]</CODE> POINTS TO THE
|
||
|
(NULL-TERMINATED) CONTENTS OF THE FIRST PARAMETER. THE FOLLOWING
|
||
|
TWO ARRAY ITEMS DO THE SAME FOR THE SECOND PARAMETER, ETC. THE
|
||
|
WHOLE ARRAY IS TERMINATED BY A NULL POINTER IN PLACE OF THE
|
||
|
NAME. IF NO PARAMETERS ARE TO BE PASSED, YOU CAN SPECIFY NULL
|
||
|
FOR <CODE>PARAMS</CODE> ITSELF.
|
||
|
</P>
|
||
|
<P CLASS="">
|
||
|
<CODE>ARGUMENTS</CODE> IS A SIMILAR ARRAY OF NAMED BUFFERS
|
||
|
TO BE PASSED TO THE STYLESHEET. (THEY CAN BE REFERRED TO VIA THE
|
||
|
'ARG:' SCHEME, SEE <A HREF="#ARGSCHEME">ABOVE</A>.) AGAIN, THE
|
||
|
ARRAY IS A SEQUENCE OF (NAME, VALUE) PAIRS TERMINATED BY NULL IN
|
||
|
PLACE OF A NAME. IF NO NAMED BUFFERS ARE TO BE PASSED, YOU CAN
|
||
|
SPECIFY NULL FOR <CODE>ARGUMENTS</CODE> ITSELF.
|
||
|
</P>
|
||
|
<P CLASS="">
|
||
|
<CODE>RESULTARG</CODE> ENABLES ONE TO ACCESS THE
|
||
|
RESULTING DOCUMENT IN CASE THE OUTPUT WENT TO A NAMED BUFFER. IN
|
||
|
THAT SITUATION, <CODE>*RESULTARG</CODE> POINTS TO THE RESULTING
|
||
|
NULL-TERMINATED STRING, ALLOCATED BY SABLOTRON. YOU CAN PASS NULL
|
||
|
FOR <CODE>RESULTARG</CODE> IF THE OUTPUT IS SURE TO GO TO A
|
||
|
FILE.
|
||
|
</P>
|
||
|
<P CLASS="">
|
||
|
<B>NOTE:</B>WHEN YOU ARE DONE PROCESSING THE STRING
|
||
|
POINTED TO BY <CODE>*RESULTARG</CODE>, FREE IT USING <A HREF="#SABLOTFREE">
|
||
|
<CODE>SABLOTFREE()</CODE>
|
||
|
</A> - NEVER USE
|
||
|
<CODE>FREE()</CODE>. THE LATTER IS GUARANTEED TO PRODUCE A
|
||
|
SEGMENTATION FAULT UNDER LINUX.
|
||
|
</P>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>
|
||
|
INT SABLOTPROCESSFILES(CHAR *STYLESHEETNAME,
|
||
|
CHAR *INPUTNAME,
|
||
|
CHAR *RESULTNAME);
|
||
|
</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">A WRAPPER FOR <CODE>SABLOTPROCESS()</CODE> WORKING ON
|
||
|
FILES. THE PARAMETERS ARE THE NULL-TERMINATED FILE NAMES OF THE
|
||
|
XSLT STYLESHEET, THE XML INPUT AND THE RESULT,
|
||
|
RESPECTIVELY. SABLOTRON OPENS THESE FILES ITSELF AND CLOSES THEM
|
||
|
AFTER THE PROCESSING IS COMPLETE. VALUES LIKE "FILE://STDIN" ARE
|
||
|
ALLOWED.</P>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>
|
||
|
INT SABLOTPROCESSSTRINGS(CHAR *STYLESHEETSTR, CHAR *INPUTSTR, CHAR
|
||
|
**RESULTSTR);
|
||
|
</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">ANOTHER WRAPPER FOR <CODE>SABLOTPROCESS()</CODE>, THIS
|
||
|
TIME FOR ACCESSING NAMED BUFFERS (I.E. USER-ALLOCATED MEMORY
|
||
|
BLOCKS)ONLY. THUS, THE FIRST PARAMETER IS A NULL-TERMINATED
|
||
|
STRING CONTAINING THE WHOLE STYLESHEET; THE SECOND PARAMETER
|
||
|
IS A NULL-TERMINATED STRING CONTAINING THE XML
|
||
|
INPUT. SABLOTRON ALLOCATES THE BUFFER FOR THE RESULTING STRING
|
||
|
AND RETURNS A POINTER TO IT IN RESULTSTR. HENCE, INVOKING
|
||
|
<CODE>PUTS(*RESULTSTR)</CODE> AFTER HAVING CALLED
|
||
|
<CODE>SABLOTPROCESSSTRINGS</CODE> SENDS THE RESULT TO
|
||
|
STDOUT. THE BUFFER ALLOCATED <B>MUST</B> BE FREED BY CALLING THE
|
||
|
FUNCTION <CODE>SABLOTFREE</CODE> DESCRIBED NEXT.
|
||
|
</P>
|
||
|
</DIV>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<A NAME="I__1205"></A>
|
||
|
<H3>
|
||
|
<A HREF="#TOC_I__1048">7.2&NBSP;&NBSP;BASIC FUNCTIONS</A>
|
||
|
</H3>
|
||
|
<P CLASS="">THE ABOVE SHORTCUTS JUST CALL THE BASIC, LOWER-LEVEL
|
||
|
FUNCTIONS DESCRIBED BELOW. NOTE THAT IF YOU NEED TO SET OPTIONS
|
||
|
FOR LOGGING ETC., YOU MAY NEED TO USE THE LOW-LEVEL
|
||
|
FUNCTIONS. </P>
|
||
|
<P CLASS="">A TYPICAL PROCESSING SESSION MAY LOOK LIKE THIS:</P>
|
||
|
<P CLASS="">
|
||
|
<PRE>
|
||
|
SABLOTHANDLE P;
|
||
|
CHAR *MY_BUF;
|
||
|
SABLOTCREATEPROCESSOR(&P);
|
||
|
SABLOTSETLOG(P, ...);
|
||
|
/* ...SET OTHER INSTANCE-SPECIFIC OPTIONS HERE... */
|
||
|
SABLOTRUNPROCESSOR(P, ...);
|
||
|
SABLOTGETRESULTARG(P, "ARG:/SOMENAME", &MY_BUF)
|
||
|
/* ...DO SOMETHING WITH MY_BUF... */
|
||
|
/* CAN RUN THE PROCESSOR AGAIN IF NECESSARY */
|
||
|
SABLOTRUNPROCESSOR(P, ...);
|
||
|
SABLOTDESTROYPROCESSOR(P);
|
||
|
</PRE>
|
||
|
</P>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>
|
||
|
INT SABLOTCREATEPROCESSOR(SABLOTHANDLE *PROCESSORPTR);
|
||
|
</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">CREATES AN INSTANCE OF SABLOTRON AND RETURNS A POINTER TO
|
||
|
IT IN *PROCESSORPTR. THIS POINTER IS PASSED ON ALL SUBSEQUENT
|
||
|
CALLS TO THIS INSTANCE. </P>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>
|
||
|
INT SABLOTDESTROYPROCESSOR(SABLOTHANDLE PROCESSOR_);
|
||
|
</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">DESTROYS AN INSTANCE OF THE PROCESSOR, DEALLOCATING ALL
|
||
|
THE MEMORY USED UP BY IT.</P>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>
|
||
|
INT SABLOTRUNPROCESSOR(SABLOTHANDLE PROCESSOR_,
|
||
|
CHAR *SHEETURI,
|
||
|
CHAR *INPUTURI,
|
||
|
CHAR *RESULTURI,
|
||
|
CHAR **PARAMS,
|
||
|
CHAR **ARGUMENTS);
|
||
|
</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">PROCESSES DOCUMENTS USING THE GIVEN PROCESSOR INSTANCE AND
|
||
|
GIVEN PARAMS AND ARGS DEFINITIONS. SEE
|
||
|
<CODE>SABLOTPROCESS()</CODE>.</P>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>
|
||
|
INT SABLOTGETRESULTARG(SABLOTHANDLE PROCESSOR_,
|
||
|
CHAR *ARGURI,
|
||
|
CHAR **ARGVALUE);
|
||
|
</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">COPIES THE RESULT 'ARG' BUFFER WITH THE GIVEN URI,
|
||
|
RETURNING A POINTER TO THE NEWLY-ALLOCATED BLOCK IN
|
||
|
*ARGVALUE. IF NO SUCH BUFFER EXISTS, RETURNS NULL IN *ARGVALUE.
|
||
|
</P>
|
||
|
<P CLASS="">THIS FUNCTION IS NECESSARY, BECAUSE IF THE RESULT DOCUMENT
|
||
|
IS OUTPUT TO MEMORY, IT WOULD BE LOST WHEN
|
||
|
<CODE>SABLOTDESTROYPROCESSOR()</CODE> IS CALLED. WHEN
|
||
|
DEALLOCATING THE COPY OBTAINED FROM
|
||
|
<CODE>SABLOTGETRESULTARG()</CODE>, USE <CODE>SABLOTFREE</CODE>
|
||
|
(NEVER <CODE>FREE()</CODE>). </P>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>
|
||
|
INT SABLOTFREERESULTARGS(SABLOTHANDLE PROCESSOR_);
|
||
|
</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">REMOVES THE SABLOTRON-INTERNAL COPIES OF THE 'ARG' BUFFERS
|
||
|
FROM THE LAST SABLOTRON RUN. NORMALLY, THERE SHOULD BE NO REASON
|
||
|
TO CALL THIS FUNCTION AS IT IS CALLED AUTOMATICALLY ON BOTH
|
||
|
<CODE>SABLOTRUNPROCESSOR()</CODE> AND
|
||
|
<CODE>SABLOTDESTROYPROCESSOR()</CODE>. </P>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>
|
||
|
<A NAME="SABLOTFREE"></A>
|
||
|
INT SABLOTFREE(CHAR *RESULTBUF);
|
||
|
</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">THIS FUNCTION FREES THE BUFFER ALLOCATED ON PREVIOUS CALL
|
||
|
TO <CODE>SABLOTPROCESSSTRINGS</CODE>. CALLING IT WITH AN
|
||
|
INVALID POINTER WILL CAUSE A CRASH.
|
||
|
</P>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>
|
||
|
INT SABLOTREGHANDLER(
|
||
|
SABLOTHANDLE PROCESSOR_,
|
||
|
HANDLERTYPE TYPE,
|
||
|
VOID *HANDLER,
|
||
|
VOID *USERDATA);
|
||
|
</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">REGISTERS AN EXTERNAL HANDLER. <CODE>TYPE</CODE> CAN BE
|
||
|
<CODE>HLR_MESSAGE</CODE>, <CODE>HLR_SCHEME</CODE>,
|
||
|
<CODE>HLR_SAX</CODE>, <CODE>HLR_MISC</CODE> OR
|
||
|
<CODE>HLR_ENC</CODE>.
|
||
|
<CODE>HANDLER</CODE> POINTS TO THE
|
||
|
CALLBACK VECTOR OF THE APPROPRIATE TYPE. <CODE>USERDATA</CODE>
|
||
|
IS A DATA ITEM TO PASSED TO ALL CALLBACKS OF THIS PARTICULAR
|
||
|
HANDLER. FOR DETAILS, CHECK THE <CODE>SABLOT.H</CODE> AND
|
||
|
<CODE>SHANDLER.H</CODE> HEADER FILES.
|
||
|
</P>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>
|
||
|
INT SABLOTUNREGHANDLER(
|
||
|
SABLOTHANDLE PROCESSOR_,
|
||
|
HANDLERTYPE TYPE,
|
||
|
VOID *HANDLER,
|
||
|
VOID *USERDATA);
|
||
|
</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">UNREGISTERS THE GIVEN EXTERNAL HANDLER. FOR DETAILS, CHECK THE
|
||
|
<CODE>SABLOT.H</CODE> AND <CODE>SHANDLER.H</CODE> HEADER
|
||
|
FILES.</P>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>
|
||
|
INT SABLOTSETLOG(
|
||
|
SABLOTHANDLE PROCESSOR_,
|
||
|
CONST CHAR *LOGFILENAME,
|
||
|
INT LOGLEVEL);
|
||
|
</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">SETS THE LOG FILENAME. THE <CODE>LOGLEVEL</CODE> PARAMETER
|
||
|
IS CURRENTLY NOT USED. PASS NULL FOR <CODE>LOGFILENAME</CODE> TO
|
||
|
TURN LOGGING OFF (DEFAULT). </P>
|
||
|
<P CLASS="">THE OTHER FUNCTIONS PUBLISHED BY SABLOT.H HAVE BEEN
|
||
|
INCLUDED FOR EXPERIMENTAL REASONS OR FOR COMPATIBILITY, AND IT
|
||
|
IS BETTER NOT TO USE THEM.
|
||
|
</P>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>
|
||
|
INT SABLOTCLEARERROR(SABLOTHANDLE PROCESSOR_);
|
||
|
</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">CLEARS THE 'PENDING ERROR' FLAG FOR THIS INSTANCE OF
|
||
|
SABLOTRON.</P>
|
||
|
</DIV>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<A NAME="I__1416"></A>
|
||
|
<H3>
|
||
|
<A HREF="#TOC_I__1048">7.3&NBSP;&NBSP;GENERALIZED INTERFACE FUNCTIONS</A>
|
||
|
</H3>
|
||
|
<P CLASS="">THE IMPLEMENTATION OF THE <A HREF="#DOM">DOM INTERFACE</A>
|
||
|
BROUGHT THE NEED TO EXTEND SOME OF THE FUNCTIONS DESCRIBED IN
|
||
|
THE PREVIOUS SECTION. THIS EXTENSION ENABLES THE USER TO:
|
||
|
</P>
|
||
|
<UL>
|
||
|
<LI>PROCESS DOCUMENTS CREATED BY THE DOM FUNCTIONS, AND</LI>
|
||
|
<LI>PROCESS FREQUENTLY USED DOCUMENTS IN PRE-PARSED FORM.</LI>
|
||
|
</UL>
|
||
|
<P CLASS="">AN OBJECT CALLED <I>SITUATION</I> IS USED TO PROVIDE A
|
||
|
PERSISTENT CONTEXT FOR ALL CALLS TO THE DOM-RELATED
|
||
|
FUNCTIONS. FUNCTIONS USED TO MANIPULATE THE SITUATION ARE DESCRIBED IN
|
||
|
<A HREF="#SITUATION">THE FOLLOWING SECTION</A>.</P>
|
||
|
<P CLASS="">
|
||
|
<B>NOTE:</B> IF NOT SPECIFIED OTHERWISE, ALL THESE
|
||
|
FUNCTIONS RETURN AN ERROR CODE. A POSITIVE VALUE INDICATES AN ERROR.</P>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>INT SABLOTCREATEDOCUMENT(SABLOTSITUATION S,
|
||
|
SDOM_DOCUMENT *D);
|
||
|
</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">CREATES AN EMPTY DOCUMENT. TYPICALLY FOLLOWED BY CALLS TO
|
||
|
DOM FUNCTIONS TO POPULATE THE DOCUMENT.</P>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>INT SABLOTDESTROYDOCUMENT(SABLOTSITUATION S,
|
||
|
SDOM_DOCUMENT D);
|
||
|
</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">DESTROYS A DOCUMENT, FREEING ALL THE NODES IT HAS CREATED.</P>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>INT SABLOTPARSE(SABLOTSITUATION S,
|
||
|
CONST CHAR *URI, SDOM_DOCUMENT *D);
|
||
|
</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">READS IN A DOCUMENT FROM THE GIVEN URI.</P>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>INT SABLOTPARSEBUFFER(SABLOTSITUATION S,
|
||
|
CONST CHAR *BUFFER, SDOM_DOCUMENT *D);
|
||
|
</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">READS IN A DOCUMENT FROM THE GIVEN IN-MEMORY BUFFER.</P>
|
||
|
<P CLASS="">THESE FUNCTIONS HAVE VARIANTS TO BE USED IF THE DOCUMENT
|
||
|
IS TO BE INTERPRETED AS AN XSLT STYLESHEET, NAMELY
|
||
|
<CODE>SABLOTPARSESTYLESHEET</CODE> AND
|
||
|
<CODE>SABLOTPARSESTYLESHEETBUFFER</CODE>.</P>
|
||
|
<P CLASS="">THE FOLLOWING FUNCTIONS GENERALIZE
|
||
|
<CODE>SABLOTRUNPROCESSOR</CODE> IN THAT THEY MAKE IT POSSIBLE TO
|
||
|
UTILIZE AN EXTRA KIND OF A SOURCE DOCUMENT: A DOM TREE.</P>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>INT SABLOTRUNPROCESSORGEN(SABLOTSITUATION S,
|
||
|
VOID *PROCESSOR_,
|
||
|
CHAR *SHEETURI,
|
||
|
CHAR *INPUTURI,
|
||
|
CHAR *RESULTURI);
|
||
|
</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">A KEY INGREDIENT OF THE EXTENDED INTERFACE. ONLY THE URIS
|
||
|
OF THE SOURCES AND OF THE RESULT DOCUMENT ARE GIVEN TO IT. THE
|
||
|
REST OF THE INFORMATION PASSED TO
|
||
|
<CODE>SABLOTRUNPROCESSOR</CODE> IS CONVEYED THROUGH
|
||
|
<CODE>SABLOTADDARGBUFFER,</CODE> <CODE>SABLOTADDARGTREE</CODE>
|
||
|
AND <CODE>SABLOTADDPARAM.</CODE> THE SCHEME PART OF THE
|
||
|
STYLESHEET URI OR THE INPUT URI MAY BE "ARG:", IN WHICH
|
||
|
CASE THEY REFER TO A BUFFER OR TREE PASSED BY THESE
|
||
|
FUNCTIONS. </P>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>INT SABLOTADDARGBUFFER(SABLOTSITUATION S,
|
||
|
VOID *PROCESSOR_,
|
||
|
CONST CHAR *ARGNAME,
|
||
|
CONST CHAR *BUFFERVALUE);
|
||
|
</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">CREATES A NAMED BUFFER FOR THE NEXT PROCESSOR RUN. THE
|
||
|
BUFFER'S NAME AND CONTENTS ARE PASSED AS ARGUMENTS. THE NAME
|
||
|
IS INTERPRETED RELATIVE TO THE 'ARG:/' SCHEME.</P>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>INT SABLOTADDARGTREE(SABLOTSITUATION S,
|
||
|
VOID *PROCESSOR_,
|
||
|
CONST CHAR *ARGNAME,
|
||
|
SDOM_DOCUMENT TREE);
|
||
|
</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">ASSOCIATES THE GIVEN DOCUMENT WITH A NAME FOR THE NEXT
|
||
|
PROCESSOR RUN. THE DOCUMENT IS <I>NOT</I> DESTROYED AFTER THE
|
||
|
RUN IS FINISHED. THE NAME IS INTERPRETED RELATIVE TO THE 'ARG:/'
|
||
|
SCHEME.</P>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>INT SABLOTADDPARAM(SABLOTSITUATION S,
|
||
|
VOID *PROCESSOR_,
|
||
|
CONST CHAR *PARAMNAME,
|
||
|
CONST CHAR *PARAMVALUE);
|
||
|
</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">ADDS A GLOBAL STYLESHEET PARAMETER FOR THE NEXT PROCESSOR
|
||
|
RUN.</P>
|
||
|
</DIV>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<A NAME="I__1578"></A>
|
||
|
<H3>
|
||
|
<A HREF="#TOC_I__1048">7.4&NBSP;&NBSP;THE SITUATION OBJECT</A>
|
||
|
</H3>
|
||
|
<P CLASS="">
|
||
|
<A NAME="SITUATION"></A>AT PRESENT, THE SITUATION OBJECT PRIMARILY HOLDS INFORMATION ON ANY PENDING ERRORS. A
|
||
|
SITUATION IS CREATED USING</P>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>INT SABLOTCREATESITUATION(SABLOTSITUATION
|
||
|
*SP);</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">AND DESTROYED BY</P>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>INT SABLOTDESTROYSITUATION(SABLOTSITUATION
|
||
|
S);</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">TO CLEAR THE PENDING ERROR FLAG IN A SITUATION, USE</P>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>INT SABLOTCLEARSITUATION(SABLOTSITUATION
|
||
|
S);</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">THE FOLLOWING SELF-EXPLANATORY FUNCTIONS EXTRACT PARTS OF THE ERROR INFORMATION
|
||
|
FROM THE SITUATION:</P>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>
|
||
|
CONST CHAR *SABLOTGETERRORURI(SABLOTSITUATION S);<BR>
|
||
|
INT SABLOTGETERRORLINE(SABLOTSITUATION S);<BR>
|
||
|
CONST CHAR *SABLOTGETERRORMSG(SABLOTSITUATION S);
|
||
|
</CODE>
|
||
|
</P>
|
||
|
</DIV>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<A NAME="I__1631"></A>
|
||
|
<H3>
|
||
|
<A HREF="#TOC_I__1048">7.5&NBSP;&NBSP;DOCUMENT OBJECT MODEL (DOM) FUNCTIONS</A>
|
||
|
</H3>
|
||
|
<P CLASS="">
|
||
|
<A NAME="DOM"></A>STARTING WITH VERSION 0.60, SABLOTRON IMPLEMENTS
|
||
|
A MAJOR SUBSET OF THE DOM LEVEL 1 CORE SPECIFICATION <A HREF="#REF-DOM">[DOM]</A>. A BRIEF
|
||
|
DESCRIPTION OF THE IMPLEMENTED INTERFACE FOLLOWS; FOR MORE
|
||
|
DETAILS, PLEASE REFER TO THE HEADER FILE NAMED
|
||
|
<CODE>SDOM.H.</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">ALL OF THE NAMES RELATED TO THE DOM INTERFACE START WITH
|
||
|
SDOM_ (FOR SABLOT DOM).</P>
|
||
|
<P CLASS="">MAJOR NEW TYPES ARE <CODE>SDOM_DOCUMENT</CODE> (A DOM TREE) AND
|
||
|
<CODE>SDOM_NODE</CODE> (A NODE OF THE TREE). A DOCUMENT CAN ALSO BE USED IN
|
||
|
PLACE OF A NODE. THIS REFLECTS THE FACT IN THE DOM SPEC,
|
||
|
DOCUMENT IS A SUBCLASS OF NODE. WHEN USED IN THIS WAY, THE
|
||
|
DOCUMENT REPRESENTS ITS OWN ROOT NODE (WHICH IS NOT THE SAME AS
|
||
|
THE `ROOT ELEMENT').</P>
|
||
|
<P CLASS="">OTHER TYPES INCLUDE:</P>
|
||
|
<UL>
|
||
|
<LI>
|
||
|
<CODE>SDOM_CHAR:</CODE> A DOM CHARACTER TYPE. CURRENTLY, THIS IS JUST
|
||
|
CHAR. NOTE THAT THE DOM SPEC REQUIRES THAT THE DOM
|
||
|
IMPLEMENTATIONS WORK WITH UTF-16. SABLOTRON DEVIATES FROM THIS
|
||
|
BY USING UTF-8 INSTEAD. A SEPARATE SET OF FUNCTIONS TAKING
|
||
|
UTF-16 STRINGS WILL BE PROVIDED.</LI>
|
||
|
<LI>
|
||
|
<CODE>SDOM_NODETYPE:</CODE> A NODE TYPE ENUM. SOME OF THE VALUES ARE
|
||
|
<CODE>SDOM_ELEMENT_NODE,</CODE> <CODE>SDOM_ATTRIBUTE_NODE</CODE> AND <CODE>SDOM_TEXT_NODE.</CODE> SEE
|
||
|
<CODE>SDOM.H</CODE> FOR THE REST.</LI>
|
||
|
<LI>
|
||
|
<CODE>SDOM_NODELIST:</CODE> A NODE LIST RETURNED BY SOME OF THE
|
||
|
FUNCTIONS.</LI>
|
||
|
<LI>
|
||
|
<CODE>SDOM_EXCEPTION:</CODE> DOM EXCEPTION CODES ENUM, WITH VALUES SUCH
|
||
|
AS <CODE>SDOM_NOT_FOUND_ERR</CODE> OR <CODE>SDOM_INVALID_NODE_TYPE</CODE>. SEE <CODE>SDOM.H</CODE>
|
||
|
FOR DETAILS.</LI>
|
||
|
</UL>
|
||
|
<P CLASS="">THE FUNCTIONS LISTED BELOW ARE IMPLEMENTED MORE OR LESS AS DEFINED IN
|
||
|
THE DOM LEVEL 1 SPECIFICATION, WITH TWO EXCEPTIONS:
|
||
|
THEIR NAMES ARE PREFIXED WITH <CODE>SDOM_</CODE> AND THE FIRST ARGUMENT IS
|
||
|
ALWAYS A <CODE>SABLOTSITUATION.</CODE> ALL THE FUNCTIONS RETURN
|
||
|
A <CODE>SDOM_EXCEPTION.</CODE> </P>
|
||
|
<UL>
|
||
|
<LI>
|
||
|
<CODE>CREATEELEMENT, CREATEATTRIBUTE, CREATETEXTNODE,
|
||
|
CREATECDATASECTION, CREATECOMMENT, CREATEPROCESSINGINSTRUCTION</CODE>
|
||
|
</LI>
|
||
|
<LI>
|
||
|
<CODE>GETNODETYPE, GETNODENAME, SETNODENAME, GETNODEVALUE, SETNODEVALUE</CODE>
|
||
|
</LI>
|
||
|
<LI>
|
||
|
<CODE>GETPARENTNODE, GETFIRSTCHILD, GETLASTCHILD, GETPREVIOUSSIBLING,
|
||
|
GETNEXTSIBLING, GETOWNERDOCUMENT</CODE>
|
||
|
</LI>
|
||
|
<LI>
|
||
|
<CODE>INSERTBEFORE, APPENDCHILD, REMOVECHILD, REPLACECHILD</CODE>
|
||
|
</LI>
|
||
|
<LI>
|
||
|
<CODE>CLONENODE</CODE>
|
||
|
</LI>
|
||
|
<LI>
|
||
|
<CODE>GETATTRIBUTE, SETATTRIBUTE, REMOVEATTRIBUTE, GETATTRIBUTELIST</CODE>
|
||
|
</LI>
|
||
|
</UL>
|
||
|
<P CLASS="">SEVERAL FUNCTIONS HAVE BEEN ADDED:</P>
|
||
|
<UL>
|
||
|
<LI>
|
||
|
<CODE>DISPOSENODE</CODE> FREES ALL MEMORY USED BY THE GIVEN NODE</LI>
|
||
|
<LI>
|
||
|
<CODE>CLONEFOREIGNNODE</CODE> CLONES A NODE FROM A DIFFERENT
|
||
|
DOCUMENT</LI>
|
||
|
<LI>
|
||
|
<CODE>DOCTOSTRING</CODE> SERIALIZES THE DOCUMENT, RETURNING THE
|
||
|
RESULTING STRING</LI>
|
||
|
<LI>
|
||
|
<CODE>XQL</CODE> PERFORMS AN XPATH QUERY ON THE DOM TREE,
|
||
|
RETURNING A LIST OF THE NODES SATISFYING IT.</LI>
|
||
|
</UL>
|
||
|
<P CLASS="">IN ADDITION, THERE ARE SOME FUNCTIONS USED TO MANIPULATE
|
||
|
THE NODE LISTS RETURNED BY <CODE>XQL</CODE> AND
|
||
|
<CODE>GETATTRIBUTELIST</CODE>. THESE INCLUDE
|
||
|
<CODE>GETNODELISTLENGTH</CODE>, <CODE>GETNODELISTITEM</CODE> AND
|
||
|
<CODE>DISPOSENODELIST</CODE>.</P>
|
||
|
<P CLASS="">FINALLY, THERE ARE FUNCTIONS TO EXTRACT DOM
|
||
|
EXCEPTION-RELATED INFORMATION FROM THE SITUATION OBJECT, NAMELY
|
||
|
<CODE>GETEXCEPTIONCODE</CODE>, <CODE>GETEXCEPTIONMESSAGE</CODE>
|
||
|
AND <CODE>GETEXCEPTIONDETAILS</CODE>.</P>
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<A NAME="I__1870"></A>
|
||
|
<H2>
|
||
|
<A HREF="#TOC_I__1870">8&NBSP;&NBSP;THE COMMAND LINE INTERFACE</A>
|
||
|
</H2>
|
||
|
<DIV>
|
||
|
<P CLASS="">SABLOTRON COMES WITH A COMMAND-LINE INTERFACE TO THE
|
||
|
SHARED LIBRARY, WHICH IS A PROGRAM NAMED
|
||
|
<CODE>SABCMD</CODE>. AT PRESENT, <CODE>SABCMD</CODE> IS INVOKED
|
||
|
AS FOLLOWS:</P>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>
|
||
|
SABCMD [<I>OPTIONS</I>] <I>STYLESHEET</I> [<I>INPUT</I> [<I>RESULT</I>]] [<I>ASSIGNMENTS</I>]
|
||
|
</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">THE ARGUMENTS ARE THE URIS OF THE XSLT STYLESHEET, THE
|
||
|
XML INPUT DOCUMENT, AND THE RESULTING DOCUMENT, RESPECTIVELY. THE
|
||
|
DEFAULT FOR <CODE>
|
||
|
<I>INPUT</I>
|
||
|
</CODE> IS
|
||
|
<CODE>FILE://STDIN</CODE> (MEANING PLAIN OLD STDIN);
|
||
|
<CODE>
|
||
|
<I>RESULT</I>
|
||
|
</CODE> DEFAULTS TO
|
||
|
<CODE>FILE://STDOUT</CODE>. FILENAMES HAVE TO INCLUDE THE EXTENSION (IF
|
||
|
ANY).</P>
|
||
|
<P CLASS="">YOU CAN DISPLAY THE LIST OF AVAILABLE OPTIONS BY TYPING
|
||
|
<CODE>SABCMD --HELP</CODE>. AMONG THE MORE USEFUL ONES ARE
|
||
|
<CODE>--LOG-FILE</CODE> (FOR SETTING THE LOG FILE) AND
|
||
|
<CODE>--MEASURE</CODE> (MEASURES AND OUTPUTS THE TOTAL
|
||
|
PROCESSING TIME).
|
||
|
</P>
|
||
|
<P CLASS="">
|
||
|
<A HREF="#FNAME-RULES">THE RULES FOR FILENAMES</A> ARE THE SAME AS
|
||
|
WITH <CODE>SABLOTPROCESS()</CODE>.
|
||
|
</P>
|
||
|
<P CLASS="">
|
||
|
<CODE>ASSIGNMENTS</CODE> IS A SERIES OF DEFINITIONS OF THE
|
||
|
FORM:</P>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>
|
||
|
NAME1=VALUE1 NAME2=VALUE2 ...
|
||
|
</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">
|
||
|
ASSIGNING VALUES TO TOP-LEVEL STYLESHEET PARAMETERS AND TO NAMED
|
||
|
BUFFERS. THESE TWO CASES ARE DISTINGUISHED BY A LEADING '$' IN
|
||
|
THE NAME OF A STYLESHEET PARAMETER. THE NAMES OF THE BUFFERS DO
|
||
|
<I>NOT</I> START WITH "ARG:". THEY MAY START WITH A SLASH; IF
|
||
|
THEY DON'T, THE SLASH IS PREPENDED.
|
||
|
</P>
|
||
|
<P CLASS="">
|
||
|
<B>NOTE:</B> IN MOST CASES, IT WILL BE NECESSARY TO QUOTE
|
||
|
THE INDIVIDUAL ASSIGNMENTS. WHETHER TO USE SINGLE OR DOUBLE
|
||
|
QUOTES MAY DEPEND ON THE SHELL USED (OR MAY IT?) SINGLE QUOTES
|
||
|
WORK FOR BASH, DOUBLE QUOTES WORK IN WINDOWS.
|
||
|
</P>
|
||
|
<P CLASS="">IF THE RESULT URI REFERS TO A NAMED BUFFER, THE OUTPUT
|
||
|
WOULD NORMALLY REMAIN BURIED IN MEMORY. SABCMD DUMPS THE BUFFER TO STANDARD
|
||
|
OUTPUT INSTEAD.
|
||
|
</P>
|
||
|
<P CLASS="">TO SUM UP AND GIVE AN EXAMPLE, THE FOLLOWING WOULD BE A
|
||
|
VALID INVOCATION OF SABCMD:</P>
|
||
|
<P CLASS="" STYLE="BACKGROUND-COLOR: #FFFFEE">
|
||
|
<CODE>
|
||
|
SABCMD SHEET.XSL ARG:/THE_INPUT "THE_INPUT=&LT;A/>"
|
||
|
"$USE_DEFAULTS=1"
|
||
|
</CODE>
|
||
|
</P>
|
||
|
<P CLASS="">THIS PROCESSES THE DOCUMENT PASSED IN THE BUFFER NAMED
|
||
|
THE_INPUT, USING A STYLESHEET FOUND IN FILE "SHEET.XSL" IN THE
|
||
|
WORKING DIRECTORY. WE ASSIGN 1 TO THE TOP-LEVEL PARAMETER CALLED
|
||
|
"USE_DEFAULTS". THE OUTPUT GOES TO STDOUT BY DEFAULT.
|
||
|
</P>
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
<DIV CLASS="AFTERSKIP">
|
||
|
<A NAME="I__2013"></A>
|
||
|
<H2>
|
||
|
<A HREF="#TOC_I__2013">9&NBSP;&NBSP;REFERENCES</A>
|
||
|
</H2>
|
||
|
<DIV>
|
||
|
<DL>
|
||
|
<DT>
|
||
|
<A NAME="REF-XSLT"></A>[XSLT]</DT>
|
||
|
<DD>
|
||
|
<A HREF="HTTP://WWW.W3.ORG/TR/1999/REC-XSLT-19991116">
|
||
|
XSL TRANSFORMATIONS (XSLT) VERSION 1.0
|
||
|
</A>
|
||
|
</DD>
|
||
|
|
||
|
<DT>
|
||
|
<A NAME="REF-XPATH"></A>[XPATH]</DT>
|
||
|
<DD>
|
||
|
<A HREF="HTTP://WWW.W3.ORG/TR/1999/REC-XPATH-19991116">
|
||
|
XML PATH LANGUAGE (XPATH) VERSION 1.0
|
||
|
</A>
|
||
|
</DD>
|
||
|
|
||
|
<DT>
|
||
|
<A NAME="REF-XML"></A>[XML]</DT>
|
||
|
<DD>
|
||
|
<A HREF="HTTP://WWW.W3.ORG/TR/1998/REC-XML-19980210">
|
||
|
EXTENSIBLE MARKUP LANGUAGE (XML) 1.0
|
||
|
</A>
|
||
|
</DD>
|
||
|
|
||
|
<DT>
|
||
|
<A NAME="REF-DOM"></A>[DOM]</DT>
|
||
|
<DD>
|
||
|
<A HREF="HTTP://WWW.W3.ORG/TR/REC-DOM-LEVEL-1">
|
||
|
DOCUMENT OBJECT MODEL LEVEL 1 SPECIFICATION, VERSION 1.0
|
||
|
</A>
|
||
|
</DD>
|
||
|
|
||
|
<DT>
|
||
|
<A NAME="REF-RCOVER"></A>[COVER]</DT>
|
||
|
<DD>
|
||
|
<A HREF="HTTP://WWW.OASIS-OPEN.ORG/COVER/SGML-XML.HTML">
|
||
|
THE XML COVER PAGES</A>
|
||
|
</DD>
|
||
|
|
||
|
<DT>
|
||
|
<A NAME="REF-XMLORG"></A>[XMLORG]</DT>
|
||
|
<DD>
|
||
|
<A HREF="HTTP://XML.ORG">XML.ORG</A>
|
||
|
</DD>
|
||
|
|
||
|
<DT>
|
||
|
<A NAME="REF-XSLINFO"></A>[XSLINFO]</DT>
|
||
|
<DD>
|
||
|
<A HREF="HTTP://WWW.XSLINFO.COM">XSLINFO.COM</A>
|
||
|
</DD>
|
||
|
|
||
|
<DT>
|
||
|
<A NAME="REF-BIBLE"></A>[XMLBIBLE14]</DT>
|
||
|
<DD>
|
||
|
<A HREF="HTTP://METALAB.UNC.EDU/XML/BOOKS/BIBLE/UPDATES/14.HTML">
|
||
|
HAROLD, E. R.: XML BIBLE, CHAPTER 14 (ONLINE PRESENTATION)
|
||
|
</A>
|
||
|
</DD>
|
||
|
</DL>
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
<HR>
|
||
|
<P STYLE="FONT-STYLE: ITALIC; MARGIN-LEFT: 0">(C) 2000 GINGER ALLIANCE S.R.O.</P>
|
||
|
</BODY>
|
||
|
</HTML>
|