This is a nice collection of useful XSLT transforms, models and reusable fragments under GPL, involving HTML tables, XML Schema, HTML GUI, MathML, SQL analogy, etc. This has been developped as part of the "Worlwide Botanical Knowledge Base" project, ( http://wwbota.free.fr/ ).
The transforms fall within the following (mutually exclusive) categories :
We develop a series of useful transforms, either acting on the structure of the document, or performing generic transforms (e.g. creating an index of words), or acting on well-knows documents (e.g. XML Schema, SVG, XHTML, ...), or merging or splitting in various ways. These transforms should be able to be re-assembled (by chaining-piping, import, or other combinations) to perform complex tasks out of simple bricks. This is coherent with the vision of an XML-centered application (see Extensible browsers and XML-compliant applications on this site). This way we could also do something as useful and flexible as the Unix shells commands (wc, sed, grep, ...), and C++ Standard Template library. This sub-project is under Lesser GNU Public Licence (LGPL), so contributions are wellcome!
An application of XSLT transforms library is XMLPublication, a Web document publication framework through XML. As an example, XMLPublication was used with this HTML page as the source for generation (see XMLPub generated pages). Currently there are some XSLT transforms here that are outdated with respect to the XMLPublication distribution, and also many useful transforms there that are not here, but this will be fixed .
Transforms marqued with XSLT 1.1 or 2.0 necessitate Saxon . Mirror on WWKBK SourceForge project Page .
XML source | XSLT | Description | Category | Domain | Output |
---|---|---|---|---|---|
FinancialReport_1.htm | HTMLtable2XML.xslt | from HTML table to XML; generates XML tags from first row <th> tags UPDATEDXSLT 1.1; see present XHTML page transformed | production | XHTML | FinancialReport_1.xml |
test.xml | queryOnSubElement.xslt | selects a given tag according to the content of a subelement | pedagogical | query | queryOnSubElement.xml |
pense-bete.xml | selectTagName.xslt | selects only given tag at any embedding level, and its content recursively | pedagogical | query | selectTagName.xml |
test.xml | identquery.xslt | identity transform | pedagogical | ||
test.xml | identity transform 2 : a good starting point to write XSLT transforms | design pattern | |||
test.xml | identquery-mode.xslt | identity transform 2 with mode attribute :an even better starting point to write XSLT transforms | design pattern | ||
jetty.xml | change-jetty.xml.xslt | Changes the port number and disables the AJP13 server in Jetty Web server. Illustrates how to find a needle in a hay stack, change that needle, and leave the rest unchanged. Reuses identity transform 2 | production, but applies to very specific documents | server configuration | jetty-new.xml |
emptyElements.xml | suppressEmptyElements.xslt | suppress empty elements (i.e. elements with no text content) | production | structure | emptySuppressed.xml |
testHREF.xml | selectHREF.xslt | extract href attributes; example of text mode output | pedagogical | XHTML | selectHREF.txt |
testHREF.xml | attributes2elements.xslt | replace attributes with elements; reuses identity transform 2 | production | structure | attributes2elements.xml |
document-to-split.xml | split.xslt | split named first-level elements into files (XSLT 1.1) NEW | pedagogical | file structure | one file per first-level element |
append.xslt | merge after last first-level element of document at URL $main all first-level elements of input document . | production | file structure | ||
wrapper.xslt | wrap a nodeset fragment of XML inside an XML document. An attribute marker is used to tell where to insert the fragment. | library | file structure | ||
test-difference-by-value.xslt | difference-by-value.xslt | difference by string value of first-level elements of trees in $v1 and $v2. Outputs a list of nodes in $v1 not having same string value as one of $v2 . | library | string, set | |
test-make-words-list.xslt: auto-sufficient stylesheet | make-words-list.xslt | from a whitespace-separated string, outputs an sorted or unsorted list of unique words occuring in $string . | library | string | |
test-split-string.xslt: auto-sufficient stylesheet | split-string.xslt | from a whitespace-separated string, outputs an list of words occuring in $string . | library | string | |
unique.xslt | Suppresses consecutive elements having same value. Parameter: $nodes : a node set (typically sorted) Output: node set with consecutive elements having same value suppressed | library | |||
sampleXMLSchema.xml | XMLSchemac++.xslt | generates C++ declarations from a XML Schema | proof of concept | XML_Schema | XMLSchema.cpp |
sampleXMLSchema.xml | XMLSchema2Example.xslt | XML Schema ==> typical instance of XML document | proof of concept | XML_Schema | instanceFromSchema.xml |
sampleXMLSchema.xml | XMLSchema2DTD.xslt | XML Schema ==> DTD | proof of concept | XML_Schema | DTDFromSchema.dtd |
sampleXMLSchema.xml | XMLSchema2GUI.xslt | XML Schema ==> HTML input form ( NEW : updated to XML Schema Recommandation) | proof of concept | XML_Schema | GUIFromSchema.xml |
sampleXMLSchema.xml | XML Schema ==> HTML Easy XML search: XPath helper | production | XML_Schema | XPath-helper.html | |
sampleXMLSchema.xml | NEW: XML Schema ==> HTML documentation | work in progress | XML_Schema | XMLSchemaHTMLdoc.html | |
FinancialReport_1.xml | example2Schema.xslt | From any XML, make a valid W3C XML Schema; also offers statistics about number of elements. XSLT 2.0 | proof of concept | XML_Schema | |
relationalDB.xml | example2simpleSchema.xslt | From any XML, make a (non W3C) simple XML Schema; also offers statistics about number of elements | production | skeletonSchema.xml | |
relationalDB.xml | SQL-join.xslt | How to do in XSLT the equivalent of a SQL join | pedagogical | reference | join.xml |
sphere.MathML.xml | Mathml2c.xslt | generate C++ code from MathML declarations representing 3D geometry | proof of concept | MathML | sphere.cpp |
substituteEltName.xml | substituteEltName.xslt | substitute occurences of element <e1> in namespace N1 into element <e2> in namespace N2 | pedagogical | structure | substitutedElt.xml |
xmi-summary.xslt |
from XMI 1.1 (UML), make a
summary as an HTML table with 5 colums |
production | XMI |
XSLT Error (org.apache.xpath.XPathException): Can not convert #RTREEFRAG to a NodeList!
xt XML_instance XSLT
or
xt XML_instance result
xt is a command-line (or Java) XSLT processor available from www.jclark.com .