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 :
Other similar ressources:
Create 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 is a sub-project under GNU Public Licence, so contributions are wellcome!
An application of XSLT transforms library is XMLPublish, a Web document
publication framework through XML. As an example,
XMLPublish was used with this HTML page as the source for generation .
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 UPDATED | 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 | identquery2.xslt | identity transform 2 : a good starting point to write XSLT transforms | design pattern | ||
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 | ||
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 list of unique words occuring in $string . | library | string | |
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 (not yet updated to XML Schema Recommandation) | 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 GUI (not yet updated to XML Schema Recommandation) | proof of concept | XML_Schema | GUIFromSchema.xml |
relationalDB.xml | example2Schema.xslt | From any XML, make a skeleton for an XML Schema; also offers statistics about number of elements NEW | production | XML_Schema | 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 |
To transform:
java -classpath /home/jars/saxon.jar com.icl.saxon.StyleSheet $*
xt Data XSLT
or
xt Data XSLT result
xt is a command-line (or Java) XSLT processor available from www.jclark.com .