rettinghaus / MEILER

MEI Lilypond Engraving Refinement
MIT License
20 stars 7 forks source link

Strip all "xsl:" prefixes #9

Closed th-we closed 8 years ago

th-we commented 8 years ago

The xsl: prefix is especially useful when creating XML that isn't supposed to be prefixed, e.g. in a situation like:

<xsl:template match="/">
  <html>
    <head>
      <title>My output</title>
      <link href="mystyle.css" rel="stylesheet"/>
    </head>
    <body>
      <xsl:apply-templates/>
    </body>
  </html>
</xsl:template>

Also, in this example, the HTML tags outnumber the XSL tags, so it's less noisy to prefix the XSL tags instead of the HTML tags.

However, mei2ly.xl currently does not contain a single element outside the XSL namespace. We could therefore make http://www.w3.org/1999/XSL/Transform the default namespace and remove all the xsl: prefixes. This would e.g. turn this code:

<xsl:template match="/">
  <xsl:text>\version "2.18.2"&#10;</xsl:text>
  <xsl:text>#(ly:set-option 'point-and-click #f)&#10;</xsl:text>
  <xsl:text>% automatically converted by mei2ly.xsl&#10;&#10;</xsl:text>
  <xsl:apply-templates/>
</xsl:template>
<!-- MEI.header -->
<!-- MEI header -->
<xsl:template match="mei:meiHead">
  <xsl:text>\header {&#10;</xsl:text>
  <xsl:apply-templates/>
  <xsl:text>}&#10;&#10;</xsl:text>
</xsl:template>

into the IMO much more readable

<template match="/">
  <text>\version "2.18.2"&#10;</text>
  <text>#(ly:set-option 'point-and-click #f)&#10;</text>
  <text>% automatically converted by mei2ly.xsl&#10;&#10;</text>
  <apply-templates/>
</template>
<!-- MEI.header -->
<!-- MEI header -->
<template match="mei:meiHead">
  <text>\header {&#10;</text>
  <apply-templates/>
  <text>}&#10;&#10;</text>
</template>

Less brain capacity is required to remove noise. Both variants are actually equivalent.

rettinghaus commented 8 years ago

As we don't produce any XML markup this could be done. But while coding I prefer having the prefixes. For a release: this would reduce the file size and sound worthwhile.

So I'm closing this for now.