From b9a410551eb6e33c829ab7435d258c7e0ed58954 Mon Sep 17 00:00:00 2001 From: Jonas Wielicki Date: Thu, 28 Sep 2017 19:51:07 +0200 Subject: [PATCH] Import the texml-related XSL files into this repository This helps against build failures due to sourceforge being unavailable. --- Dockerfile | 1 + texml-xsl/cmp.xsl | 318 +++++++++ texml-xsl/date-time.xsl | 1447 +++++++++++++++++++++++++++++++++++++++ texml-xsl/example.xsl | 90 +++ texml-xsl/markup.xsl | 789 +++++++++++++++++++++ texml-xsl/math.xsl | 618 +++++++++++++++++ texml-xsl/node.xsl | 229 +++++++ texml-xsl/stdlib.xsl | 340 +++++++++ texml-xsl/string.xsl | 1233 +++++++++++++++++++++++++++++++++ texml-xsl/svg.xsl | 1 + texml-xsl/uri.xsl | 580 ++++++++++++++++ xep2texml.xsl | 2 +- 12 files changed, 5647 insertions(+), 1 deletion(-) create mode 100644 texml-xsl/cmp.xsl create mode 100644 texml-xsl/date-time.xsl create mode 100644 texml-xsl/example.xsl create mode 100644 texml-xsl/markup.xsl create mode 100644 texml-xsl/math.xsl create mode 100644 texml-xsl/node.xsl create mode 100644 texml-xsl/stdlib.xsl create mode 100644 texml-xsl/string.xsl create mode 100644 texml-xsl/svg.xsl create mode 100644 texml-xsl/uri.xsl diff --git a/Dockerfile b/Dockerfile index f0c22cf7..f97e318b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,6 +10,7 @@ COPY *.xml xep.* *.css *.xsl *.js *.xsl Makefile /src/ COPY resources/*.pdf /src/resources/ COPY tools/*.py /src/tools/ COPY inbox/*.xml inbox/*.ent inbox/*.dtd /src/inbox/ +COPY texml-xsl/*.xsl /src/texml-xsl/ WORKDIR /src RUN OUTDIR=/var/www/html/extensions/ make -j$NCORES $TARGETS diff --git a/texml-xsl/cmp.xsl b/texml-xsl/cmp.xsl new file mode 100644 index 00000000..59ec8a5f --- /dev/null +++ b/texml-xsl/cmp.xsl @@ -0,0 +1,318 @@ + + + + + + + + $Id$ + + + Hummel + Mark + + + 2003 + Mark Hummel + + + + XML Compare + + +
+ Introduction + + This module provides a template for comparing two xml documents. + +
+
+ +
+ + + + Compare + + + Compare two xml documents and display differences. Two xml documents are defined to be the same if: They have the matching elements and attributes, and that the data in the elements also match. The comparison is order sensitive. + + The element names from the documents at the current depth are compared, followed by their values, then any attribute names and values are compared. The process is applied then to the subtrees of the documents. + + Notes: If there are leaf nodes in one nodeset which don't exist in the other, the value of those 'extra' elements won't appear as a difference. + + + + + + + ns1 + ns2 + + The two nodesets which are to be compared. + + + + + + + Returns the difference between the documents. + + The format of the output is an xml document. A node is added to the result tree for every difference. The node contains the type of difference (e.g element name difference, attribute value difference, etc), the value in the first nodeset and the value in the second nodeset, and the parent node. The indentation level is the depth at which the difference was found relative to the first document. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + node[]: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ diff --git a/texml-xsl/date-time.xsl b/texml-xsl/date-time.xsl new file mode 100644 index 00000000..f2c96cff --- /dev/null +++ b/texml-xsl/date-time.xsl @@ -0,0 +1,1447 @@ + + + + + + + $Id$ + + + Diamond + Jason + + + 2004 + Steve Ball + + + 2001 + Jason Diamond + + + + Date/Time Processing + + +
+ Introduction + + This module provides templates for formatting and parsing date/time strings. + + See http://www.tondering.dk/claus/calendar.html for more information on calendars and the calculations this library performs. + +
+
+ +
+ + + Returns a string with a formatted date/time. + + + The formatted date/time is determined by the format parameter. The default format is %Y-%m-%dT%H:%M:%S%z, the W3C format. + + + + + + + xsd-date-time + + The date-time value in XML Schemas (WXS) format. + If this value is specified, it takes priority over other parameters. + + + + + year + + Year + + + + + month + + Month (1 - 12; January = 1) + + + + + day + + Day of month (1 - 31) + + + + + hour + + Hours since midnight (0 - 23) + + + + + minute + + Minutes after hour (0 - 59) + + + + + second + + Seconds after minute (0 - 59) + + + + + time-zone + + Time zone string (e.g., 'Z' or '-08:00') + + + + + format + + The format specification. + + + + %a + + Abbreviated weekday name + + + + + %A + + Full weekday name + + + + + %b + + Abbreviated month name + + + + + %B + + Full month name + + + + + %c + + Date and time representation appropriate for locale + + + + + %d + + Day of month as decimal number (01 - 31) + + + + + %e + + Day of month as decimal number (1 - 31) + + + + + %H + + Hour in 24-hour format (00 - 23) + + + + + %I + + Hour in 12-hour format (01 - 12) + + + + + %i + + Hour in 12-hour format (1 - 12) + + + + + %j + + Day of year as decimal number (001 - 366) + + + + + %m + + Month as decimal number (01 - 12) + + + + + %n + + Month as decimal number (1 - 12) + + + + + %M + + Minute as decimal number (00 - 59) + + + + + %P + + Current locale's A.M./P.M. indicator for 12-hour clock, uppercase + + + + + %Q + + Current locale's A.M./P.M. indicator for 12-hour clock, uppercase with periods + + + + + %p + + Current locale's A.M./P.M. indicator for 12-hour clock, lowercase + + + + + %q + + Current locale's A.M./P.M. indicator for 12-hour clock, lowercase with periods + + + + + %S + + Second as decimal number (00 - 59) + + + + + %U + + Week of year as decimal number, with Sunday as first day of week (00 - 53) + + + + + %w + + Weekday as decimal number (0 - 6; Sunday is 0) + + + + + %W + + Week of year as decimal number, with Monday as first day of week (00 - 53) + + + + + %x + + Date representation for current locale + + + + + %X + + Time representation for current locale + + + + + %y + + Year without century, as decimal number (00 - 99) + + + + + %Y + + Year with century, as decimal number + + + + + %z + + Time-zone name or abbreviation; no characters if time zone is unknown + + + + + %% + + Percent sign + + + + + + + + + + + + Returns a formatted date/time string. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + % + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [not implemented] + + + + + 0 + + + + + + + + + + 0 + + + + + + + 12 + 0 + + 0 + + + + + + + 12 + + + + + + + + + + [not implemented] + + + + + 0 + + + + + + + + + + 0 + + + + + + + am + pm + + + + + + am + p.m. + + + + + + AM + PM + + + + + + AM + P.M. + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [not implemented] + + + + + [not implemented] + + + + + [not implemented] + + + + + + + + + + + + + + + % + + + + + + + + + + + + + + + + + + + + + + + Calculates the day of the week. + + + Given any Gregorian date, this calculates the day of the week. + + + + + + year + + Year + + + + month + + Month (1 - 12; January = 1) + + + + day + + Day of month (1 - 31) + + + + + + + Returns the day of the week (0 - 6; Sunday = 0). + + + + + + + + + + + + + + + + + + + Calculates the number of days for a specified month. + + + Given any Gregorian month, this calculates the last day of the month. + + + + + + year + + Year + + + + month + + Month (1 - 12; January = 1) + + + + + + + Returns the number of days in given month as a decimal number. + + + + + + + + + + + 29 + 28 + + + + + 30 + 31 + + + + + 30 + 31 + + + + + + + Gets the day of the week's full name. + + + Converts a numeric day of the week value into a string representing the day's full name. + + + + + + day-of-the-week + + Day of the week (0 - 6; Sunday = 0) + + + + + + + Returns a string. + + + + + + + + + Sunday + Monday + Tuesday + Wednesday + Thursday + Friday + Saturday + error: + + + + + + Gets the day of the week's abbreviation. + + + Converts a numeric day of the week value into a string representing the day's abbreviation. + + + + + + day-of-the-week + + Day of the week (0 - 6; Sunday = 0) + + + + + + + Returns a string. + + + + + + + + + Sun + Mon + Tue + Wed + Thu + Fri + Sat + error: + + + + + + Gets the month's full name. + + + Converts a numeric month value into a string representing the month's full name. + + + + + + month + + Month (1 - 12; Januaray = 1) + + + + + + + Returns a string. + + + + + + + + + January + February + March + April + May + June + July + August + September + October + November + December + error: + + + + + + Gets the month's abbreviation. + + + Converts a numeric month value into a string representing the month's abbreviation. + + + + + + month + + Month (1 - 12; Januaray = 1) + + + + + + + Returns a string. + + + + + + + + + Jan + Feb + Mar + Apr + May + Jun + Jul + Aug + Sep + Oct + Nov + Dec + error: + + + + + + Calculates the Julian Day for a specified date. + + + Given any Gregorian date, this calculates the Julian Day. + + + + + + year + + Year + + + + month + + Month (1 - 12; January = 1) + + + + day + + Day of month (1 - 31) + + + + + + + Returns the Julian Day as a decimal number. + + + + + + + + + + + + + + + + + + + Returns a string with a formatted date for a specified Julian Day. + + + Given any Julian Day, this returns a string according to the format specification. + + + + + + julian-day + + A Julian Day + + + + format + + The format specification. See dt:format-date-time for more details. + + + + + + + A string. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Calculates the week number for a specified date. + + + Assumes Monday is the first day of the week. + + + + + + year + + Year + + + + month + + Month (1 - 12; January = 1) + + + + day + + Day of month (1 - 31) + + + + + + + Returns the week number as a decimal number. + + + + + + + + + + + + + + + + + + + + + + + + + + + Take a month by name and return a number which can be used as input to the templates. + + + Input + + + + + + month + + Month as described either by full name or abbreviation. + + + + + + + Return a month as a decimal number. (Jan = 1) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Return year component of XSD DateTime value. + + + Extract component of XML Schemas DateTime value. + + + + + + xsd-date-time + + A value in XSD DateTime format. + + + + + + + Returns year component. + + + + + + + + + + + + + + + + + + + + + + + + + Return month component of XSD DateTime value. + + + Extract component of XML Schemas DateTime value. + + + + + + xsd-date-time + + A value in XSD DateTime format. + + + + + + + Returns month component. + + + + + + + + + + + + + + + + + + + + + + + + + Return day component of XSD DateTime value. + + + Extract component of XML Schemas DateTime value. + + + + + + xsd-date-time + + A value in XSD DateTime format. + + + + + + + Returns day component. + + + + + + + + + + + + + + + + + + + + + + + + + Return hour component of XSD DateTime value. + + + Extract component of XML Schemas DateTime value. + + + + + + xsd-date-time + + A value in XSD DateTime format. + + + + + + + Returns hour component. + + + + + + + + + + + + + + + + + + + + + + + + + + Return minute component of XSD DateTime value. + + + Extract component of XML Schemas DateTime value. + + + + + + xsd-date-time + + A value in XSD DateTime format. + + + + + + + Returns minute component. + + + + + + + + + + + + + + + + + + + + + + + + + + Return second component of XSD DateTime value. + + + Extract component of XML Schemas DateTime value. + + + + + + xsd-date-time + + A value in XSD DateTime format. + + + + + + + Returns second component. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Return timezone component of XSD DateTime value. + + + Extract component of XML Schemas DateTime value. + + + + + + xsd-date-time + + A value in XSD DateTime format. + + + + + + + Returns timezone component. + + + + + + + + Z + + + + + + + + + + + + + + + + - + + + + + + + + + + + +
diff --git a/texml-xsl/example.xsl b/texml-xsl/example.xsl new file mode 100644 index 00000000..790c6cbe --- /dev/null +++ b/texml-xsl/example.xsl @@ -0,0 +1,90 @@ + + + + + + + + $Id$ + + + Ball + Steve + + + 2001 + Steve Ball + + + + Example Stylesheet + + +
+ Introduction + + This module provides a template for adding stylesheet modules to the XSLT Standard Library. + To add a new module to the library, follow these easy steps: + + + Copy this file and replace its contents with the new module templates and documentation. + + + Copy the corresponding test file in the test directory. Replace its contents with tests for the new module. + + + Add an include element in the stdlib.xsl stylesheet. + + + Add an entry in the test/test.xml file. + + + Add entries in the test/test.xsl stylesheet. + + + Add an entry in the doc/build.xml file. + + + + The example.xsl stylesheet provides a more extensive example. + +
+
+ +
+ + + Template Example + + + Provides a template for writing templates. Replace this paragraph with a description of your template + + + + + + text + + The example string + + + + + + + Returns nothing. + + + + + + + +
+ diff --git a/texml-xsl/markup.xsl b/texml-xsl/markup.xsl new file mode 100644 index 00000000..dc78c4bf --- /dev/null +++ b/texml-xsl/markup.xsl @@ -0,0 +1,789 @@ + + + + + + $Id$ + + + Ball + Steve + + + 2003 + 2001 + Steve Ball + + + + XML Markup Templates + + +
+ Introduction + + This stylesheet module provides functions for generating literal XML markup. + +
+
+ +
+ + + Create an XML Declaration + + + This template returns an XML Declaration. Although the XSLT standard provides control over the generation of the XML Declaration, this template may be useful in circumstances where the values must be computed at runtime. + + + + + + version + + Version number. + + + + standalone + + Standalone indication. Must be value "yes" or "no". + + + + encoding + + Character encoding. + + + + + + + Returns an XML Declaration as a string. + + + + + + + + + <?xml version=" + + " + + + + + standalone=" + + " + + + invalid value "" for standalone attribute + + + + + encoding=" + + " + + + ?> + + + + + Create a Document Type Declaration + + + This template returns a Document Type Declaration. Although the XSLT standard provides control over the generation of a Document Type Declaration, this template may be useful in circumstances where the values for the identifiers or the internal subset must be computed at runtime. + + + + + + docel + + The name of the document element. + + + + publicid + + The public identifier for the external DTD subset. + + + + systemid + + The system identifier for the external DTD subset. + + + + internaldtd + + The internal DTD subset. + + + + + + + Returns a Document Type Declaration as a string. + + + + + + + + + + + No document element specified + + + <!DOCTYPE + + + + + + + + + + [ + + ] + + + > + + + + + Create an Element Declaration + + + This template returns an element declaration.. + + + + + + type + + The element type. + + + + content-spec + + The content specification. + + + + + + + Returns an element declaration as a string. + + + + + + + + + element type must be specified + + + content specification must be specified + + + <!ELEMENT + + + + > + + + + Create an Attribute List Declaration + + + This template returns an attribute list declaration. + + + + + + type + + The element type. + + + + attr-defns + + Attribute definitions. + + + + + + + Returns an attribute list declaration as a string. + + + + + + + + + element type must be specified + + + <!ATTLIST + + + + > + + + + Create an Attribute Definition + + + This template returns an attribute definition. + + + + + + name + + The attribute name. + + + + type + + The attribute type. + + + + default + + The attribute default. + + + + + + + Returns an attribute definition as a string. + + + + + + + + + + attribute name must be specified + + + attribute type must be specified + + + attribute default must be specified + + + + + + + + + + + + Create an Entity Declaration + + + This template returns an entity declaration. + If the 'text' parameter is given a value, then an internal entity is created. If either the 'publicid' or 'systemid' parameters are given a value then an external entity is created. It is an error for the 'text' parameter to have value as well as the 'publicid', 'systemid' or 'notation' parameters. + + + + + + name + + The entity name. + + + + parameter + + Boolean value to determine whether a parameter entity is created. Default is 'false()'. + + + + text + + The replacement text. Must be a string. + + + + nodes + + The replacement text as a nodeset. The nodeset is formatted as XML using the as-xml template. If both text and nodes are specified then nodes takes precedence. + + + + publicid + + The public identifier for an external entity. + + + + systemid + + The system identifier for an external entity. + + + + notation + + The notation for an external entity. + + + + + + + Returns an entity declaration as a string. + + + + + + + + + + + + + + entity name must be specified + + + both replacement text and external identifier specified + + + <!ENTITY + + + + % + + + + + + + + + + + + + + + + + + + + + + + + + + + NDATA " + + " + + + > + + + + Quote an Attribute Value + + + This template returns a quoted value. + + + + + + value + + The value to quote. + + + + + + + Returns a quote value as a string. + + + + + + + + + + + + + + + + + < + + &lt; + + + + + + + + + + + + + + " + ' + + + + " + + + " + + &quot; + + + " + + + ' + + ' + + + " + + " + + + + + + Create an External Identifier + + + This template returns an external identifier. + + + + + + publicid + + The public identifier. + + + + systemid + + The system identifier. + + + + + + + Returns an external identifier as a string. + + + + + + + + + + + + + + PUBLIC " + + " + + " + + " + + + + + + + SYSTEM " + + " + + + + + + Create an Entity Reference + + + This template returns an entity reference. + + + + + + name + + The name of the entity. + + + + + + + Returns an entity reference as a string. + + + + + + + & + + ; + + + + + Create a Notation Declaration + + + This template returns a notation declaration. + + + + + + name + + The notation name. + + + + publicid + + The public identifier for the notation. + + + + systemid + + The system identifier for the notation. + + + + + + + Returns a notation declaration as a string. + + + + + + + + + + notation name must be specified + + + external identifier must be specified + + + <!NOTATION + + + + + + + + + > + + + + Create a CDATA Section + + + This template returns a CDATA Section. The XSLT specification provides a mechanism for instructing the XSL processor to output character data in a CDATA section for certain elements, but this template may be useful in those circumstances where not all instances of an element are to have their content placed in a CDATA section. + + + + + + text + + The content of the CDATA section. + + + + + + + Returns a CDATA section as a string. + + + + + + + + CDATA section contains "]]>" + + + <![CDATA[ + + ]]> + + + + Format Nodeset As XML Markup + + + This template returns XML markup. Each node in the given nodeset is converted to its equivalent XML markup. + + BUG: This version may not adequately handle XML Namespaces. + + + + + + nodes + + Nodeset to format as XML. + + + + + + + Returns XML markup. + + + + + + + + + + < + + + + + = + + + + + + + + > + + + + </ + + > + + + /> + + + + + + + + <!-- + + --> + + + <? + + + + ?> + + + + + + + + + + + + + +
diff --git a/texml-xsl/math.xsl b/texml-xsl/math.xsl new file mode 100644 index 00000000..d1a2b6a8 --- /dev/null +++ b/texml-xsl/math.xsl @@ -0,0 +1,618 @@ + + + + + + + $Id$ + + + Ball + Steve + + + 2004 + 2002 + Steve Ball + + + + Math Module + + +
+ Introduction + + This module provides mathematical functions. +
+
+ +
+ + + Power + + + Raises a number to a power. + + + + + + base + + The base number. Must be a number. + + + + power + + The power to raise the number to. Must be an integer. + + + + + + + Returns base multiplied by itself power times. If the base or power are not numbers or if the power is fractional then an empty string is returned. + + + + + + + + + + 1 + + + 1 + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Conversion + + + Converts a hexidecimal value to a decimal value. + + + + + + value + + The hexidecimal number. Must be a number in hexidecimal format. + + + + + + + Returns the value as a decimal string. If the value is not a number then a NaN value is returned. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 10 + 11 + 12 + 13 + 14 + 15 + + + + + Ordinal number + + + Gives the ordinal number of a given counting number. For example, 1 becomes "1st". + + + + + + number + + An integer number. + + + + + + + Returns the number with an ordinal suffix. + + + + + + + + + + + + th + st + nd + rd + th + + + + + + + + Returns an ordinal number + + + This template returns the ordinal number for a given counting number as a word. For example "first" for 1. + Only handles numbers less than 10000000 (ten million). + + + + + + number + + The counting number. + + + + conjunctive + + Whether to add the word "and" to the result, for example "one hundred and first" rather than "one hundred first". Default is "yes". + + + + + + + Returns the ordinal number as a string. + + + + + + + + + + + zeroth + + + + + and + first + + + and + second + + + and + third + + + and + fourth + + + and + fifth + + + and + sixth + + + and + seventh + + + and + eighth + + + and + ninth + + + and + tenth + + + and + eleventh + + + and + twelveth + + + and + thirteenth + + + and + fourteenth + + + and + fifteenth + + + and + sixteenth + + + and + seventeenth + + + and + eighteenth + + + and + nineteenth + + + and + twentieth + + + and + thirtieth + + + and + fortieth + + + and + fiftieth + + + and + sixtieth + + + and + seventieth + + + and + eightieth + + + and + ninetieth + + + + + + + millionth + + + and + + + + thousandth + + + and + + + + hundredth + + + + + + and + + + + + + + + + + + + + + + + + + + + + + + + + + and + + + + + + + + + + + + + + + + + + + + + + + + + + + and + + + + + + + + + + + + + + + and + + + + + + + + + + + + + + + + + Returns a number as a word + + + This template returns the word for a given integer number, for example "one" for 1. + Only handles numbers less than 10000000 (ten million). + + + + + + number + + The counting number. + + + + conjunctive + + Adds the word "and" where appropriate, for example. + + + + + + + Returns the number as a string. + + + + + + + + + + zero + + + minus + + + + + + + + + + + + million + + + + + + million + + + + + + + + + thousand + + + + + + thousand + and + + + + + + + + + hundred + + + + + + hundred + and + + + + + + one + two + three + four + five + six + seven + eight + nine + ten + eleven + twelve + thirteen + fourteen + fifteen + sixteen + seventeen + eighteen + nineteen + twenty + thirty + forty + fifty + sixty + seventy + eighty + ninety + + + + + + + + + + + + +
+ diff --git a/texml-xsl/node.xsl b/texml-xsl/node.xsl new file mode 100644 index 00000000..c8d20b45 --- /dev/null +++ b/texml-xsl/node.xsl @@ -0,0 +1,229 @@ + + + + + + + + $Id$ + + + Ball + Steve + + + 2001 + Steve Ball + + + + Node Templates + + +
+ Introduction + + This stylesheet module provides functions for reporting on or manipulating nodes and nodesets. + +
+
+ +
+ + + Returns an XPath location path + + + This template returns an XPath location path that uniquely identifies the given node within the document. + + + + + + node + + The node to create an XPath for. If this parameter is given as a nodeset, then the first node in the nodeset is used. + + + + + + + Returns an XPath location path as a string. + + + + + + + + + + + + / + [] + + + + + + /comment() + [] + + + + /processing-instruction() + [] + + + + /text() + [] + + + + / + + + + /namespace:: + + + + /@ + + + + + + + /.. + + + + + + + + Return node type + + + Returns the type of a node as a string. + + + + + + node + + The node to get the type for. If this parameter is given as a nodeset, then the first node in the nodeset is used. + + + + + + + Returns node type as a string. Values returned are: + + + Element + + element + + + + Text Node + + text + + + + Comment + + comment + + + + Processing Instruction + + processing instruction + + + + + + + + + + + + + element + + + text + + + comment + + + processing instruction + + + root + + + namespace + + + attribute + + + + + + Copy Nodes + + + Makes a copy of the given nodes, including attributes and descendants. + + + + + + nodes + + The nodes to copy. + + + + + + + Returns the copied nodes as a result tree fragment. + + + + + + + + + + + + + + + + + + +
+ diff --git a/texml-xsl/stdlib.xsl b/texml-xsl/stdlib.xsl new file mode 100644 index 00000000..22c35ca8 --- /dev/null +++ b/texml-xsl/stdlib.xsl @@ -0,0 +1,340 @@ + + +]> + + + + + + + + + + + + + + + + + + + + XSLT Standard Library + Version &version; + + + + Ball + Steve + + + 2004 + 2002 + Steve Ball + + + + + The XSLT Standard Library, xsltsl, provides the XSLT developer with a set of XSLT templates for commonly used functions. These are implemented purely in XSLT, that is they do not use any extensions. + xsltsl is a SourceForge project. + + + + + + SourceForge Logo + + + Goals of the xsltsl project include: + + + Provision of a high-quality library of XSLT templates, suitable for inclusion by vendors in XSLT processor software products. + + + Demonstration of best practice in XSLT stylesheet development and documentation. + + + Provide examples of various techniques used to develop XSLT stylesheets (ie. a working FAQ). + + + + + + Using The Library + + There are two ways of using the library: + + + Use a local copy of the library. + + + Download the distribution (see below). + + + Unpack the distribution, using either gunzip/tar or unzip. + + + In your stylesheet import or include either the main stylesheet, stdlib.xsl, or the stylesheet module you wish to use, such as string.xsl. This example assumes that the distribution has been extracted into the same directory as your own stylesheet: + + +]]> + + + + + + Import or include either the main stylesheet, or the stylesheet module you wish to use, directly from the library website; http://xsltsl.sourceforge.net/modules/. The modules directory always contains the latest stable release. For example: + + +]]> + + Older versions of the library are available in subdirectories. For example, to access version 1.1 of the library use: + + +]]> + + + + Next, add XML Namespace declarations for the modules you wish to use. For example, to use templates from the string module, your stylesheet should have the following declaration: + + + + +]]> + + Finally, use a template with the call-template element. Most templates require parameters, which are passed using the with-param element. For example: + + + + + a word + another word + + +]]> + + + + + Obtaining The Library + + The XSLT Standard Library is available for download as either: + + + Gzip'd tarball: http://prdownloads.sourceforge.net/xsltsl/xsltsl-&version;.tar.gz + + + Zip file: http://prdownloads.sourceforge.net/xsltsl/xsltsl-&version;.zip + + + + + + Getting Involved + + Contributions to the project are most welcome, and may be in the form of stylesheet modules, patches, bug reports or sample code. Any contributed code must use the LGPL license to be accepted into the library. + + See the SourceForge Project Page http://sourceforge.net/projects/xsltsl/ for information on the development of the project. Bug reports may be submitted here. + + See the project Web Page http://xsltsl.sourceforge.net/ for documentation. + + There are three mailing lists for the project: + + + xsltsl-users@lists.sourceforge.net + + Discussion of the use of xsltsl. + + + + xsltsl-devel@lists.sourceforge.net + + Discussion of the development of xsltsl. + + + + xsltsl-announce@lists.sourceforge.net + + Project announcements. + + + + + + + XML Namespaces + + Apart from the XSLT XML Namespace (http://www.w3.org/1999/XSL/Transform), xsltsl employs a number of XML Namespaces to allow inclusion of the library in developer stylesheets. In addition, documentation is defined in a separate namespace. + Each module is allocated a namespace URI by appending the module name to the URI for the project, http://xsltsl.org/. For example, the string module has the namespace URI http://xsltsl.org/string. + All documentation is written using an extension of DocBook designed for embedding DocBook into XSLT stylesheets. The namespace URI for DocBook embedded in stylesheets is http://xsltsl.org/xsl/documentation/1.0 + + + + Engineering Standards + + In order to maintain a high engineering standard, all modules and contributions to the xsltsl project must adhere to the following coding and documentation standards. Submissions which do not meet (or exceed) this standard will not be accepted. + + + All stylesheets must be indented, with each level indented by two spaces. NB. a simple stylesheet could be used to enforce/fix this. + + + Templates are named using a qualified name (QName). The namespace URI for the template's containing stylesheet is assigned as above. + + + Parameters for templates should use sensible names. Where possible (or if in doubt), follow these conventions: + + + A parameter containing a single node is named node. Where more than one parameter contains a single node, the suffix Node is appended to the parameter name, eg. referenceNode + + + A parameter which potentially contains multiple nodes is named nodes. Where more than one parameter potentially contains multiple nodes, the suffix Nodes is appended to the parameter name, eg. copyNodes + + + A parameter which contains a string value is named text. + + + + + All templates in each stylesheet must be documented. A template is documented as a DocBook RefEntry. + + + Every stylesheet must include a test suite. The test system is in the test subdirectory. See test/test.html for further details. + + + + An example stylesheet has been provided, which acts as a template for new stylesheet modules. + + + + + Related Work + + The EXSLT project is creating a library to standardise extension functions. The XSLT Standard Library is complementary to the EXSLT project. + + + + + Reference Documentation + + Reference documentation is available for each module. + +
+ String Processing + + + + string.xsl + + +
+ +
+ Nodes + + + + node.xsl + + +
+ +
+ Date/Time Processing + + + + date-time.xsl + + +
+ +
+ Mathematics + + + + math.xsl + + +
+ +
+ URI (Uniform Resource Identifier) Processing + + + + uri.xsl + + +
+ +
+ Comparing Nodesets + + + + cmp.xsl + + +
+ +
+ Generating XML Markup + + + + markup.xsl + + +
+ +
+ Presentation Media Support + + + + Scalable Vector Graphics: svg.xsl + + + +
+ +
+ Example + + + + + + example.xsl + + +
+
+ +
+ +
diff --git a/texml-xsl/string.xsl b/texml-xsl/string.xsl new file mode 100644 index 00000000..1c7bf74c --- /dev/null +++ b/texml-xsl/string.xsl @@ -0,0 +1,1233 @@ + + + + + + + + $Id$ + + + Ball + Steve + + + 2002 + 2001 + Steve Ball + + + + String Processing + + +
+ Introduction + + This module provides templates for manipulating strings. + +
+
+ +
+ + + + + + + + + + + + + Make string uppercase + + + Converts all lowercase letters to uppercase. + + + + + + text + + The string to be converted + + + + + + + Returns string with all uppercase letters. + + + + + + + + + + + + + + ß + + + S + S + + + + + + + + + Make string lowercase + + + Converts all uppercase letters to lowercase. + + + + + + text + + The string to be converted + + + + + + + Returns string with all lowercase letters. + + + + + + + + + + + Capitalise string + + + Converts first character of string to an uppercase letter. All remaining characters are converted to lowercase. + + + + + + text + + The string to be capitalised + + + + all + + Boolean controlling whether all words in the string are capitalised. + Default is true. + + + + + + + Returns string with first character uppcase and all remaining characters lowercase. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Convert a string to one camelcase word + + + Converts a string to one lowerCamelCase or UpperCamelCase + word, depending on the setting of the "upper" + parameter. UpperCamelCase is also called MixedCase while + lowerCamelCase is also called just camelCase. The template + removes any spaces, tabs and slashes, but doesn't deal with + other punctuation. It's purpose is to convert strings like + "hollow timber flush door" to a term suitable as identifier or + XML tag like "HollowTimberFlushDoor". + + + + + + + text + + The string to be capitalised + + + + upper + + Boolean controlling whether the string becomes an + UpperCamelCase word or a lowerCamelCase word. + Default is true. + + + + + + + Returns string with first character uppcase and all remaining characters lowercase. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + String extraction + + + Extracts the portion of string 'text' which occurs before any of the characters in string 'chars'. + + + + + + text + + The string from which to extract a substring. + + + + chars + + The string containing characters to find. + + + + + + + Returns string. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + String extraction + + + Extracts the portion of string 'text' which occurs after the last of the character in string 'chars'. + + + + + + text + + The string from which to extract a substring. + + + + chars + + The string containing characters to find. + + + + + + + Returns string. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + String extraction + + + Extracts the portion of string 'text' which occurs before the first character of the last occurance of string 'chars'. + + + + + + text + + The string from which to extract a substring. + + + + chars + + The string containing characters to find. + + + + + + + Returns string. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + String substitution + + + Substitute 'replace' for 'with' in string 'text'. + + + + + + text + + The string upon which to perform substitution. + + + + replace + + The string to substitute. + + + + with + + The string to be substituted. + + + + disable-output-escaping + + A value of yes indicates that the result should have output escaping disabled. Any other value allows normal escaping of text values. The default is to enable output escaping. + + + + + + + Returns string. + + + + + + + + no + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Count Substrings + + + Counts the number of times a substring occurs in a string. This can also counts the number of times a character occurs in a string, since a character is simply a string of length 1. + + + + Counting Lines + + + + +]]> + + + + + + text + + The source string. + + + + chars + + The substring to count. + + + + + + + Returns a non-negative integer value. + + + + + + + + + + 0 + + + + + + + + + + + + 0 + + + + + + String extraction + + Extracts the portion of a 'char' delimited 'text' string "array" at a given 'position'. + + + + + text + + The string from which to extract a substring. + + + + chars + + delimiters + + + + position + + position of the elements + + + + all + + If true all of the remaining string is returned, otherwise only the element at the given position is returned. Default: false(). + + + + + + Returns string. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + String extraction + + Extracts the portion of a 'char' delimited 'text' string "array" at a given 'position' + + + + + text + + The string from which to extract a substring. + + + + chars + + delimiters + + + + position + + position of the elements + + + + + + Returns string. + + + + + + + + + + + + + + + + + + + + + + + + + + + String insertion + + Insert 'chars' into "text' at any given "position' + + + + + text + + The string upon which to perform insertion + + + + position + + the position where insertion will be performed + + + + with + + The string to be inserted + + + + + + Returns string. + + + + + + + + + + + + + + + + + String reversal + + + Reverse the content of a given string + + + + + + text + + The string to be reversed + + + + + + + Returns string. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Format a string + + + Inserts newlines and spaces into a string to format it as a block of text. + + + + + + text + + String to be formatted. + + + + max + + Maximum line length. + + + + indent + + Number of spaces to insert at the beginning of each line. + + + + justify + + Justify left, right or both. Not currently implemented (fixed at "left"). + + + + + + + Formatted block of text. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Find first occurring character in a string + + + Finds which of the given characters occurs first in a string. + + + + + + text + + The source string. + + + + chars + + The characters to search for. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Match A String To A Pattern + + + Performs globbing-style pattern matching on a string. + + + + Match Pattern + + + + +]]> + + + + + + text + + The source string. + + + + pattern + + The pattern to match against. Certain characters have special meaning: + + + * + + Matches zero or more characters. + + + + ? + + Matches a single character. + + + + \ + + Character escape. The next character is taken as a literal character. + + + + + + + + + + Returns "1" if the string matches the pattern, "0" otherwise. + + + + + + + + + + + 1 + + + 1 + + + 0 + + + + + + + + + + + + + + + + + + + + + + 0 + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + 1 + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + Create A Repeating Sequence of Characters + + + Repeats a string a given number of times. + + + + + + text + + The string to repeat. + + + + count + + The number of times to repeat the string. + + + + + + + + + + + + + + + + + + + + + + +
+ diff --git a/texml-xsl/svg.xsl b/texml-xsl/svg.xsl new file mode 100644 index 00000000..5eed1f0e --- /dev/null +++ b/texml-xsl/svg.xsl @@ -0,0 +1 @@ + $Id$ Ball Steve 2002 Steve Ball SVG Stylesheet
Introduction This module provides templates for creating SVG images.
Aqua-style Button Part of the mechanism to create an Aqua-style button. Include a call to this template in your SVG document's defs element. This template only needs to be included once. Use this in conjunction with svg:aqua-button. The default values for color1, color2 and color3 result in a grey button. prefix A prefix to append to the identifiers used, so that they don't clash with other identifiers. Default: "aqua-". color1 The base colour of the button. Default: "#d9d9d9". color2 A "background" colour for the button. Should be a darker colour than color1. Default: "#a9a9a9". color3 A highlight colour for the button. Should be a lighter colour than color1. Default: "#f9f9f9". Returns SVG result-tree-fragment. Aqua-style Button Part of the mechanism to create an Aqua-style button. Include a call to this template in your SVG document where you want a button to appear. This template can be used many times in a single SVG document. Use this in conjunction with svg:aqua-button-defs. prefix A prefix to append to the identifiers used, so that they don't clash with other identifiers. Default: "aqua-". Returns SVG result-tree-fragment.
\ No newline at end of file diff --git a/texml-xsl/uri.xsl b/texml-xsl/uri.xsl new file mode 100644 index 00000000..7beed10e --- /dev/null +++ b/texml-xsl/uri.xsl @@ -0,0 +1,580 @@ + + + + + + + + $Id$ + + + Diamond + Jason + + + 2001 + Jason Diamond + + + + URI (Uniform Resource Identifier) Processing + + +
+ Introduction + This module provides templates for processing URIs (Uniform Resource Identifers). +
+
+ +
+ + + Determines if a URI is absolute or relative. + + + Absolute URIs start with a scheme (like "http:" or "mailto:"). + + + + + + uri + + An absolute or relative URI. + + + + + + + Returns 'true' if the URI is absolute or '' if it's not. + + + + + + + + + + + + + + Gets the scheme part of a URI. + + + The ':' is not part of the scheme. + + + + + + uri + + An absolute or relative URI. + + + + + + + Returns the scheme (without the ':') or '' if the URI is relative. + + + + + + + + + + + + Gets the authority part of a URI. + + + The authority usually specifies the host machine for a resource. It always follows '//' in a typical URI. + + + + + + uri + + An absolute or relative URI. + + + + + + + Returns the authority (without the '//') or '' if the URI has no authority. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Gets the path part of a URI. + + + The path usually comes after the '/' in a URI. + + + + + + uri + + An absolute or relative URI. + + + + + + + Returns the path (with any leading '/') or '' if the URI has no path. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Gets the query part of a URI. + + + The query comes after the '?' in a URI. + + + + + + uri + + An absolute or relative URI. + + + + + + + Returns the query (without the '?') or '' if the URI has no query. + + + + + + + + + + + + + + + + + + + Gets the fragment part of a URI. + + + The fragment comes after the '#' in a URI. + + + + + + uri + + An absolute or relative URI. + + + + + + + Returns the fragment (without the '#') or '' if the URI has no fragment. + + + + + + + + + + + + Resolves a URI reference against a base URI. + + + This template follows the guidelines specified by RFC 2396. + + + + + + reference + + A (potentially relative) URI reference. + + + + base + + The base URI. + + + + document + + The URI of the current document. This defaults to the value of the base URI if not specified. + + + + + + + The "combined" URI. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/xep2texml.xsl b/xep2texml.xsl index 8e2af75e..348ce3ae 100644 --- a/xep2texml.xsl +++ b/xep2texml.xsl @@ -29,7 +29,7 @@ --> - +