<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.tei-c.org/index.php?action=history&amp;feed=atom&amp;title=GenerateDefaultAttributeRemover.xslt</id>
	<title>GenerateDefaultAttributeRemover.xslt - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.tei-c.org/index.php?action=history&amp;feed=atom&amp;title=GenerateDefaultAttributeRemover.xslt"/>
	<link rel="alternate" type="text/html" href="https://wiki.tei-c.org/index.php?title=GenerateDefaultAttributeRemover.xslt&amp;action=history"/>
	<updated>2026-04-21T08:03:39Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.32.0</generator>
	<entry>
		<id>https://wiki.tei-c.org/index.php?title=GenerateDefaultAttributeRemover.xslt&amp;diff=4253&amp;oldid=prev</id>
		<title>Piotr Banski: typo</title>
		<link rel="alternate" type="text/html" href="https://wiki.tei-c.org/index.php?title=GenerateDefaultAttributeRemover.xslt&amp;diff=4253&amp;oldid=prev"/>
		<updated>2008-03-22T04:16:51Z</updated>

		<summary type="html">&lt;p&gt;typo&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 04:16, 22 March 2008&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l2&quot; &gt;Line 2:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 2:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Remove-Default-Attributes.xslt]].&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Remove-Default-Attributes.xslt]].&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This method is more &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;compliated&lt;/del&gt;, but works for any TEI P4 DTD, and probably for lots of non-TEI DTDs as well.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This method is more &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;complicated&lt;/ins&gt;, but works for any TEI P4 DTD, and probably for lots of non-TEI DTDs as well.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# If you don't have one already, generate a flat version of your DTD with the [http://www.tei-c.org.uk/pizza.html pizza chef].&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# If you don't have one already, generate a flat version of your DTD with the [http://www.tei-c.org.uk/pizza.html pizza chef].&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Piotr Banski</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.tei-c.org/index.php?title=GenerateDefaultAttributeRemover.xslt&amp;diff=4251&amp;oldid=prev</id>
		<title>Syd: New page: If you want to remove default attributes from your TEI P4 XML files, this may be for you. If you just use vanilla TEI Lite P4, then you could just use  Remove-Default-Attributes.xslt. ...</title>
		<link rel="alternate" type="text/html" href="https://wiki.tei-c.org/index.php?title=GenerateDefaultAttributeRemover.xslt&amp;diff=4251&amp;oldid=prev"/>
		<updated>2008-03-20T19:48:09Z</updated>

		<summary type="html">&lt;p&gt;New page: If you want to remove default attributes from your TEI P4 XML files, this may be for you. If you just use vanilla TEI Lite P4, then you could just use  &lt;a href=&quot;/index.php?title=Remove-Default-Attributes.xslt&quot; title=&quot;Remove-Default-Attributes.xslt&quot;&gt;Remove-Default-Attributes.xslt&lt;/a&gt;. ...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;If you want to remove default attributes from your TEI P4 XML files, this may be for you. If you just use vanilla TEI Lite P4, then you could just use &lt;br /&gt;
[[Remove-Default-Attributes.xslt]].&lt;br /&gt;
&lt;br /&gt;
This method is more compliated, but works for any TEI P4 DTD, and probably for lots of non-TEI DTDs as well.&lt;br /&gt;
&lt;br /&gt;
# If you don't have one already, generate a flat version of your DTD with the [http://www.tei-c.org.uk/pizza.html pizza chef].&lt;br /&gt;
# Convert the flat DTD to RELAX NG (XML syntax). This may be done using &amp;lt;tt&amp;gt;trang&amp;lt;/tt&amp;gt;; oXygen gives a nice GUI front-end to &amp;lt;tt&amp;gt;trang&amp;lt;/tt&amp;gt; from the &amp;quot;Tools&amp;quot; menu (it's called &amp;quot;Trang converter…&amp;quot;.)&lt;br /&gt;
# Resolve references to attribute lists in the resulting RELAX NG schema by applying [[relaxng_refAtt_resolver.xslt]].&lt;br /&gt;
# Feed the resulting schema as input to this stylesheet. The output will be a stylesheet that will remove default attributes from instances.&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;xsl:stylesheet xmlns:xsl=&amp;quot;http://www.w3.org/1999/XSL/Transform&amp;quot; version=&amp;quot;1.0&amp;quot;&lt;br /&gt;
  xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot; xmlns:rng=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- &lt;br /&gt;
    Reads in a TEI RELAX NG (XML syntax) file that has been pre-processed such that references&lt;br /&gt;
    to &amp;lt;define&amp;gt; of attribute lists have been resolved (i.e., via relaxng_refAtt_resolver.xslt),&lt;br /&gt;
    and writes out XSLT that removes default attributes from instances.&lt;br /&gt;
    Created 2008-03-20 by Syd Bauman&lt;br /&gt;
  --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;xsl:output indent=&amp;quot;yes&amp;quot; method=&amp;quot;xml&amp;quot; omit-xml-declaration=&amp;quot;no&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;xsl:template match=&amp;quot;/&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;!-- output an XSLT 1.0 stylesheet --&amp;gt;&lt;br /&gt;
    &amp;lt;xsl:element name=&amp;quot;xsl:stylesheet&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;xsl:attribute name=&amp;quot;version&amp;quot;&amp;gt;1.0&amp;lt;/xsl:attribute&amp;gt;&lt;br /&gt;
      &amp;lt;!-- would we put namespace decls here, if we needed them? --&amp;gt;&lt;br /&gt;
      &amp;lt;xsl:text&amp;gt;&amp;amp;#x0A;&amp;lt;/xsl:text&amp;gt;&lt;br /&gt;
      &amp;lt;xsl:comment&amp;gt; This stylesheet generated by generate_default_attr_remover.xslt &amp;lt;/xsl:comment&amp;gt;&lt;br /&gt;
      &amp;lt;xsl:text&amp;gt;&amp;amp;#x0A;&amp;lt;/xsl:text&amp;gt;&lt;br /&gt;
      &amp;lt;!-- spit out a generic copy-everything template ala http://www.tei-c.org/wiki/index.php/Copy-All.xsl --&amp;gt;&lt;br /&gt;
      &amp;lt;xsl:comment&amp;gt; Generic copy-everything template &amp;lt;/xsl:comment&amp;gt;&lt;br /&gt;
      &amp;lt;xsl:element name=&amp;quot;xsl:template&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;xsl:attribute name=&amp;quot;match&amp;quot;&amp;gt;*|@*|processing-instruction()|comment()&amp;lt;/xsl:attribute&amp;gt;&lt;br /&gt;
        &amp;lt;xsl:element name=&amp;quot;xsl:copy&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;xsl:element name=&amp;quot;xsl:apply-templates&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;xsl:attribute name=&amp;quot;select&amp;quot;&lt;br /&gt;
            &amp;gt;*|@*|text()|processing-instruction()|comment()&amp;lt;/xsl:attribute&amp;gt;&lt;br /&gt;
          &amp;lt;/xsl:element&amp;gt;&lt;br /&gt;
        &amp;lt;/xsl:element&amp;gt;&lt;br /&gt;
      &amp;lt;/xsl:element&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      &amp;lt;xsl:text&amp;gt;&amp;amp;#x0A;&amp;lt;/xsl:text&amp;gt;&lt;br /&gt;
      &amp;lt;xsl:comment&amp;gt; get rid of TEIform= attrs whose value match GI &amp;lt;/xsl:comment&amp;gt;&lt;br /&gt;
      &amp;lt;xsl:comment&amp;gt; see http://www.tei-c.org/wiki/index.php/Remove-Default-Attributes.xslt &amp;lt;/xsl:comment&amp;gt;&lt;br /&gt;
      &amp;lt;xsl:comment&amp;gt; for detailed comments. &amp;lt;/xsl:comment&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      &amp;lt;xsl:element name=&amp;quot;xsl:template&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;xsl:attribute name=&amp;quot;match&amp;quot;&amp;gt;@TEIform&amp;lt;/xsl:attribute&amp;gt;&lt;br /&gt;
        &amp;lt;xsl:element name=&amp;quot;xsl:if&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;xsl:attribute name=&amp;quot;test&amp;quot;&amp;gt;not( . = name(..) )&amp;lt;/xsl:attribute&amp;gt;&lt;br /&gt;
          &amp;lt;xsl:element name=&amp;quot;xsl:attribute&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;xsl:attribute name=&amp;quot;name&amp;quot;&amp;gt;TEIform&amp;lt;/xsl:attribute&amp;gt;&lt;br /&gt;
            &amp;lt;xsl:element name=&amp;quot;xsl:value-of&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;xsl:attribute name=&amp;quot;select&amp;quot;&amp;gt;.&amp;lt;/xsl:attribute&amp;gt;&lt;br /&gt;
            &amp;lt;/xsl:element&amp;gt;&lt;br /&gt;
          &amp;lt;/xsl:element&amp;gt;&lt;br /&gt;
        &amp;lt;/xsl:element&amp;gt;&lt;br /&gt;
      &amp;lt;/xsl:element&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      &amp;lt;xsl:text&amp;gt;&amp;amp;#x0A;&amp;lt;/xsl:text&amp;gt;&lt;br /&gt;
      &amp;lt;xsl:comment&amp;gt; When we hit an element/attribute combination that has a default value &amp;lt;/xsl:comment&amp;gt;&lt;br /&gt;
      &amp;lt;xsl:comment&amp;gt; in the schema, test to see if the value specified is the same as the &amp;lt;/xsl:comment&amp;gt;&lt;br /&gt;
      &amp;lt;xsl:comment&amp;gt; default value in the schema. If it is not, write out the attribute as &amp;lt;/xsl:comment&amp;gt;&lt;br /&gt;
      &amp;lt;xsl:comment&amp;gt; it was specified in the instance; if it is, do nothing, thus dropping &amp;lt;/xsl:comment&amp;gt;&lt;br /&gt;
      &amp;lt;xsl:comment&amp;gt; the entire attribute from the output. &amp;lt;/xsl:comment&amp;gt;&lt;br /&gt;
      &lt;br /&gt;
      &amp;lt;xsl:text&amp;gt;&amp;amp;#x0A;&amp;lt;/xsl:text&amp;gt;&lt;br /&gt;
      &amp;lt;!-- now, for each default attribute found in the input schema ... --&amp;gt;&lt;br /&gt;
      &amp;lt;xsl:apply-templates select=&amp;quot;//rng:attribute[@a:defaultValue]&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/xsl:element&amp;gt;&lt;br /&gt;
  &amp;lt;/xsl:template&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;!-- ... apply a template --&amp;gt;&lt;br /&gt;
  &amp;lt;xsl:template match=&amp;quot;rng:attribute[@a:defaultValue]&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;xsl:if test=&amp;quot;not(@name='TEIform')&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;xsl:text&amp;gt;&amp;amp;#x0A;&amp;lt;/xsl:text&amp;gt;&lt;br /&gt;
      &amp;lt;xsl:element name=&amp;quot;xsl:template&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;xsl:attribute name=&amp;quot;match&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;xsl:value-of select=&amp;quot;ancestor::rng:element[1]/@name&amp;quot;/&amp;gt;&lt;br /&gt;
          &amp;lt;xsl:text&amp;gt;/@&amp;lt;/xsl:text&amp;gt;&lt;br /&gt;
          &amp;lt;xsl:value-of select=&amp;quot;@name&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/xsl:attribute&amp;gt;&lt;br /&gt;
        &amp;lt;xsl:element name=&amp;quot;xsl:if&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;xsl:attribute name=&amp;quot;test&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;xsl:text&amp;gt;not( . = '&amp;lt;/xsl:text&amp;gt;&lt;br /&gt;
            &amp;lt;xsl:value-of select=&amp;quot;@a:defaultValue&amp;quot;/&amp;gt;&lt;br /&gt;
            &amp;lt;xsl:text&amp;gt;' )&amp;lt;/xsl:text&amp;gt;&lt;br /&gt;
          &amp;lt;/xsl:attribute&amp;gt;&lt;br /&gt;
          &amp;lt;xsl:element name=&amp;quot;xsl:attribute&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;xsl:attribute name=&amp;quot;name&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;xsl:value-of select=&amp;quot;@name&amp;quot;/&amp;gt;&lt;br /&gt;
            &amp;lt;/xsl:attribute&amp;gt;&lt;br /&gt;
            &amp;lt;xsl:element name=&amp;quot;xsl:value-of&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;xsl:attribute name=&amp;quot;select&amp;quot;&amp;gt;.&amp;lt;/xsl:attribute&amp;gt;&lt;br /&gt;
            &amp;lt;/xsl:element&amp;gt;&lt;br /&gt;
          &amp;lt;/xsl:element&amp;gt;&lt;br /&gt;
        &amp;lt;/xsl:element&amp;gt;&lt;br /&gt;
      &amp;lt;/xsl:element&amp;gt;&lt;br /&gt;
    &amp;lt;/xsl:if&amp;gt;&lt;br /&gt;
  &amp;lt;/xsl:template&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/xsl:stylesheet&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[Category:XSLT]]&lt;/div&gt;</summary>
		<author><name>Syd</name></author>
		
	</entry>
</feed>