Metamark Wrapping: putting brackets around spanning markup

A project PI recently asked me the following XSLT question: In my TEI I have the following markup: How do I wrap a bracket around the <metamark> to <anchor> pairing, and moreover how do I make it red? That is, … Continue reading

Posted in TEI, XML, XSLT | 2 Comments

Tokenizing and grouping rhyme schemes with XSLT functions

There is a project I work for which has encoded rhyme schemes in TEI using the @rhyme attribute on <lg> elements.  This contains some complex strings as they have used parentheses to indicate an internal rhyme and asterisks to indicate … Continue reading

Posted in TEI, XML, XSLT | Leave a comment

grouping by group-adjacent=”boolean(self::lb)”

A project I was doing some work for had some input that looked like: What they wanted as output was a table-layout (icky) that aligned two nested tables of the original and the transliteration like: If we ignore the icky … Continue reading

Posted in TEI, XML, XSLT | Leave a comment

simple dynamic transformation of xml with htaccess, php, and xslt

I often transform from TEI XML to XHTML as part of projects, but in some instances it is more difficult to manage using things like the eXist XML Database or Apache Cocoon, or even AxKit. This is because the hosting … Continue reading

Posted in other, TEI, XSLT | Leave a comment

For Loops in XSLT2

A colleague asked me the other day about the proper way to do for-loops in XSLT2 or more specifically in XPath2. He knows all about xsl:for-each and xsl:for-each-group iteration over things, and of course recursively calling a template while passing … Continue reading

Posted in XSLT | Leave a comment


Rehdon asked me about giving @xml:id attributes to things, so I whipped up this quick XSLT stylesheet. Some people prefer to use generate-id() to get a truly random and unique ID without semantic baggage. In many cases, where IDs are … Continue reading

Posted in TEI, XSLT | 2 Comments

adding word-level markup

Rehdon and snail and others occasionally have asked me recently about marking up words inside another element where there may be markup (sometimes containing more than one word) inside this so I thought I’d write it up. So for example … Continue reading

Posted in XML, XSLT | 4 Comments

XSLT2 collection() with dynamic collections from directory listings

Something I didn’t know about XSLT2’s collection() function. I had previously used it in the form: where docs.xml has a structure of: You can then address, via the variable, the structure of those files blort1 and blort2 and iterate over … Continue reading

Posted in XML, XSLT | 1 Comment