Skip to content

Commit

Permalink
Merge branch 'release-0.5.2alpha'
Browse files Browse the repository at this point in the history
  • Loading branch information
bwbohl committed Nov 6, 2014
2 parents 484baae + 749bdf3 commit 6cc15be
Show file tree
Hide file tree
Showing 20 changed files with 8,191 additions and 154 deletions.
2 changes: 1 addition & 1 deletion build.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project default="xar" name="freidi-tools">

<property name="project.version" value="0.5alpha"/>
<property name="project.version" value="0.5.2alpha"/>
<property name="project.app" value="freidi-tools"/>
<property name="build.dir" value="build"/>

Expand Down
2 changes: 1 addition & 1 deletion expath-pkg.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<package xmlns="http://expath.org/ns/pkg" name="http://freischuetz-digital.de/tools" abbrev="freidi-tools" version="0.5.1alpha" spec="1.0">
<package xmlns="http://expath.org/ns/pkg" name="http://freischuetz-digital.de/tools" abbrev="freidi-tools" version="0.5.2alpha" spec="1.0">
<title>Freischuetz Tools</title>
<dependency package="http://exist-db.org/apps/shared"/>
</package>
64 changes: 61 additions & 3 deletions pitchtool/addScoreDef.xsl
Original file line number Diff line number Diff line change
@@ -1,4 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mei="http://www.music-encoding.org/ns/mei" xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl" exclude-result-prefixes="xs xd" version="2.0"><xd:doc scope="stylesheet"><xd:desc><xd:p><xd:b>Created on:</xd:b> Jun 24, 2013</xd:p><xd:p><xd:b>Author:</xd:b> johannes</xd:p><xd:p>
This stylesheet pulls a scoreDef from a given file and adds it to an XML snippet as provided by the ProofMyData tool.
</xd:p></xd:desc></xd:doc><xsl:output method="xml" indent="yes"/><xsl:param name="pageFilePath" as="xs:string"/><xsl:param name="staffN" as="xs:string"/><xsl:variable name="pageFile" select="doc($pageFilePath)"/><xsl:template match="/"><xsl:apply-templates/></xsl:template><xsl:template match="mei:score"><xsl:copy><xsl:apply-templates select="@*"/><xsl:apply-templates select="$pageFile//mei:scoreDef[ancestor::mei:annot[@type='providedScoreDef']][1]"/><xsl:apply-templates select="node()"/></xsl:copy></xsl:template><xsl:template match="mei:staffGrp"><xsl:if test=".//mei:staffDef[@n = $staffN]"><xsl:copy><xsl:apply-templates select="node() | @*"/></xsl:copy></xsl:if></xsl:template><xsl:template match="mei:staffDef[@n != $staffN]"/><xsl:template match="node() | @*"><xsl:copy><xsl:apply-templates select="node() | @*"/></xsl:copy></xsl:template></xsl:stylesheet>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mei="http://www.music-encoding.org/ns/mei" xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl" exclude-result-prefixes="xs xd" version="2.0">
<!--
- Freischütz-Digital
- pmd.pitchControl
- Copyright Johannes Kepper 2013.
- kepper(at)edirom.de
-
- http://www.github.com/edirom/ediromSourceManager
-
- ## Description & License
-
- This stylesheet pulls a scoreDef from a given file and adds it to an XML snippet as provided by the ProofMyData tool
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<xd:doc scope="stylesheet">
<xd:desc>
<xd:p><xd:b>Created on:</xd:b> Jun 24, 2013</xd:p>
<xd:p><xd:b>Author:</xd:b> johannes</xd:p>
<xd:p> This stylesheet pulls a scoreDef from a given file and adds it to an XML snippet as provided by the ProofMyData tool. </xd:p>
</xd:desc>
</xd:doc>
<xsl:output method="xml" indent="yes"/>
<xsl:param name="pageFilePath" as="xs:string"/>
<xsl:param name="staffN" as="xs:string"/>
<xsl:variable name="pageFile" select="doc($pageFilePath)"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="mei:score">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates select="$pageFile//mei:scoreDef[ancestor::mei:annot[@type='providedScoreDef']][1]"/>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="mei:staffGrp">
<xsl:if test=".//mei:staffDef[@n = $staffN]">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:if>
</xsl:template>
<xsl:template match="mei:staffDef[@n != $staffN]"/>
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
25 changes: 25 additions & 0 deletions pitchtool/checkWellformedness.xql
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
(:Freischütz-Digital
: pmd.pitchControl
: Copyright Johannes Kepper & Daniel Röwenstrunk 2012.
: kepper(at)edirom.de & roewenstrunk(at)edirom.de
:
: http://www.github.com/edirom/ediromSourceManager
:
: ## Description & License
:
: This file parses a xml snippet in eXist-db to check it for its wellformedness
:
: This program is free software: you can redistribute it and/or modify
: it under the terms of the GNU General Public License as published by
: the Free Software Foundation, either version 3 of the License, or
: (at your option) any later version.
:
: This program is distributed in the hope that it will be useful,
: but WITHOUT ANY WARRANTY; without even the implied warranty of
: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: GNU General Public License for more details.
:
: You should have received a copy of the GNU General Public License
: along with this program. If not, see <http://www.gnu.org/licenses/>.
:)

xquery version "3.0";

declare namespace mei="http://www.music-encoding.org/ns/mei";
Expand Down
100 changes: 89 additions & 11 deletions pitchtool/extractStaff.xsl
Original file line number Diff line number Diff line change
@@ -1,12 +1,90 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mei="http://www.music-encoding.org/ns/mei" xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl" exclude-result-prefixes="xs xd xlink mei" version="2.0"><xd:doc scope="stylesheet"><xd:desc><xd:p><xd:b>Created on:</xd:b> Jun 21, 2013</xd:p><xd:p><xd:b>Author:</xd:b> johannes</xd:p><xd:p>
This stylesheet extracts a single staff from a page-based MEI-file for conversion to abc.
The $staffN parameter defines which staff should be extracted.
The $mode parameter defines if the target is abc or something else.
If $mode = 'abc', a
predefined scoreDef available in the header will be embedded in the document.
If $mode = 'ace' (or other), it will be returned without this addition.
</xd:p></xd:desc></xd:doc><xsl:output method="xml" indent="yes" encoding="UTF-8"/><xsl:param name="staffN" as="xs:string"/><xsl:param name="mode" as="xs:string"/><xsl:variable name="providedScoreDef" select="exists(//mei:annot[@type = 'providedScoreDef'])" as="xs:boolean"/><xsl:template match="/"><xsl:variable name="firstPass"><xsl:apply-templates select="//mei:score"/></xsl:variable><xsl:apply-templates select="$firstPass" mode="cleanup"/></xsl:template><xsl:template match="mei:score"><score><xsl:apply-templates select="@*"/><xsl:if test="$providedScoreDef and $mode = 'abc'"><xsl:apply-templates select="//mei:annot[@type = 'providedScoreDef']//mei:scoreDef"/></xsl:if><xsl:apply-templates select="node()"/></score></xsl:template><xsl:template match="mei:staff[@n != $staffN]"/>
<!-- <xsl:template match="mei:measure/mei:*[local-name() != 'staff' and @staff and $staffN != tokenize(@staff,' ')]"/>--><xsl:template match="mei:measure/mei:*[local-name() != 'staff']"/><xsl:template match="mei:staffGrp"><xsl:if test=".//mei:staffDef[@n = $staffN]"><xsl:copy><xsl:apply-templates select="node() | @*"/></xsl:copy></xsl:if></xsl:template><xsl:template match="mei:staffDef[@n != $staffN]"/><xsl:template match="@facs"/><xsl:template match="node() | @*"><xsl:copy><xsl:apply-templates select="node() | @*"/></xsl:copy></xsl:template>

<!-- mode cleanup --><xsl:template match="mei:score/text()" mode="cleanup" priority="2"/><xsl:template match="mei:section/text()" mode="cleanup" priority="2"/><xsl:template match="mei:measure/text()" mode="cleanup" priority="2"/><xsl:template match="mei:staffGrp/text()" mode="cleanup" priority="2"/><xsl:template match="*" mode="cleanup" priority="1"><xsl:element name="{local-name(.)}" namespace="http://www.music-encoding.org/ns/mei"><xsl:apply-templates select="node() | @*" mode="#current"/></xsl:element></xsl:template><xsl:template match="text() | processing-instruction() | comment()" mode="cleanup" priority="1"><xsl:copy><xsl:apply-templates select="node() | @*" mode="#current"/></xsl:copy></xsl:template><xsl:template match="@*" mode="cleanup" priority="1"><xsl:copy/></xsl:template></xsl:stylesheet>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mei="http://www.music-encoding.org/ns/mei" xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl" exclude-result-prefixes="xs xd xlink mei" version="2.0">
<!--
- Freischütz-Digital
- pmd.pitchControl
- Copyright Johannes Kepper 2013.
- kepper(at)edirom.de
-
- http://www.github.com/edirom/ediromSourceManager
-
- ## Description & License
-
- This stylesheet extracts a single staff from a page-based MEI-file for conversion to abc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<xd:doc scope="stylesheet">
<xd:desc>
<xd:p><xd:b>Created on:</xd:b> Jun 21, 2013</xd:p>
<xd:p><xd:b>Author:</xd:b> johannes</xd:p>
<xd:p> This stylesheet extracts a single staff from a page-based MEI-file for conversion to abc. The $staffN parameter defines which staff should be extracted. The $mode parameter defines if the target is abc or something else. If $mode = 'abc', a predefined scoreDef available in the header will be embedded in the document. If $mode = 'ace' (or other), it will be returned without this addition. </xd:p>
</xd:desc>
</xd:doc>
<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
<xsl:param name="staffN" as="xs:string"/>
<xsl:param name="mode" as="xs:string"/>
<xsl:variable name="providedScoreDef" select="exists(//mei:annot[@type = 'providedScoreDef'])" as="xs:boolean"/>
<xsl:template match="/">
<xsl:variable name="firstPass">
<xsl:apply-templates select="//mei:score"/>
</xsl:variable>
<xsl:apply-templates select="$firstPass" mode="cleanup"/>
</xsl:template>
<xsl:template match="mei:score">
<score>
<xsl:apply-templates select="@*"/>
<xsl:if test="$providedScoreDef and $mode = 'abc'">
<xsl:apply-templates select="//mei:annot[@type = 'providedScoreDef']//mei:scoreDef"/>
</xsl:if>
<xsl:apply-templates select="node()"/>
</score>
</xsl:template>
<xsl:template match="mei:staff[@n != $staffN]"/>
<!-- <xsl:template match="mei:measure/mei:*[local-name() != 'staff' and @staff and $staffN != tokenize(@staff,' ')]"/>-->
<xsl:template match="mei:measure/mei:*[local-name() != 'staff']"/>
<xsl:template match="mei:staffGrp">
<xsl:if test=".//mei:staffDef[@n = $staffN]">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:if>
</xsl:template>
<xsl:template match="mei:staffDef[@n != $staffN]"/>
<xsl:template match="@facs"/>
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>

<!-- mode cleanup -->
<xsl:template match="mei:score/text()" mode="cleanup" priority="2"/>
<xsl:template match="mei:section/text()" mode="cleanup" priority="2"/>
<xsl:template match="mei:measure/text()" mode="cleanup" priority="2"/>
<xsl:template match="mei:staffGrp/text()" mode="cleanup" priority="2"/>
<xsl:template match="*" mode="cleanup" priority="1">
<xsl:element name="{local-name(.)}" namespace="http://www.music-encoding.org/ns/mei">
<xsl:apply-templates select="node() | @*" mode="#current"/>
</xsl:element>
</xsl:template>
<xsl:template match="text() | processing-instruction() | comment()" mode="cleanup" priority="1">
<xsl:copy>
<xsl:apply-templates select="node() | @*" mode="#current"/>
</xsl:copy>
</xsl:template>
<xsl:template match="@*" mode="cleanup" priority="1">
<xsl:copy/>
</xsl:template>
</xsl:stylesheet>
Loading

0 comments on commit 6cc15be

Please sign in to comment.