Difference between revisions of "Id-to-xml-id.xslt"
Jump to navigation
Jump to search
m (< to <) |
m |
||
| Line 30: | Line 30: | ||
<xsl:template match="*[@id]"> | <xsl:template match="*[@id]"> | ||
<xsl:if test="@xml:id"> | <xsl:if test="@xml:id"> | ||
| − | <xsl:message>WARNING: deleting the existing xml:id=<xsl:value-of select="@xml:id"/> attribute of | + | <xsl:message>WARNING: deleting the existing xml:id=<xsl:value-of select="@xml:id"/> attribute of</nowiki></pre> |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | </nowiki></pre> | ||
| − | |||
| − | |||
Revision as of 20:11, 3 July 2007
This stylesheet changes id= attributes to xml:id= attributes. That is all.
<?xml version="1.0" encoding="UTF-8"?>
<!-- Tiny XSLT 1.0 stylesheet that reads in a TEI P4:2004 file (or -->
<!-- any other XML file, really) and writes out the same file with -->
<!-- the id= attribute changed to the xml:id= attribute. -->
<!-- Copyleft 2006 Syd Bauman and the Text Encoding Initiative Consortium -->
<!-- The output of this stylesheet is not P5-comnpliant XML; it is just -->
<!-- the same P4 document with xml:id= instead of id=. -->
<!-- Note that if an element already has both an id= and an xml:id=, we -->
<!-- nuke the old xml:id= and replace it with what used to be id= (and -->
<!-- issue a warning). -->
<!-- Written 2006-05-05 by Syd Bauman -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:tei="http://www.tei-c.org/ns/1.0">
<xsl:import href="Copy-All.xsl"/>
<xsl:output method="xml"
encoding="UTF-8"
cdata-section-elements="eg"/>
<!-- special template for elements with id= that have to change -->
<xsl:template match="*[@id]">
<xsl:if test="@xml:id">
<xsl:message>WARNING: deleting the existing xml:id=<xsl:value-of select="@xml:id"/> attribute of