1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" indent="no"/>
<xsl:template match="/">@prefix : <http://lv2plug.in/ns/lv2core#> .
@prefix swh: <http://plugin.org.uk/swh-plugins/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix doap: <http://usefulinc.com/ns/doap#> .
@prefix swhext: <http://plugin.org.uk/extensions#> .
@prefix pg: <http://lv2plug.in/ns/ext/port-groups#> .
@prefix pprops: <http://lv2plug.in/ns/ext/port-props#> .
<xsl:for-each select="ladspa/plugin">
<xsl:variable name="pluglabel" select="@label"/>
<xsl:for-each select="group">
<xsl:variable name="grouplabel" select="@label"/>
<xsl:variable name="groupuri">
<xsl:value-of select="$pluglabel"/>-<xsl:value-of select="$grouplabel"/>
</xsl:variable>
swh:<xsl:value-of select="$groupuri"/> a pg:Group ;
a pg:<xsl:value-of select="@type"/> ;
:symbol "<xsl:value-of select="$grouplabel"/>"<xsl:if test="@source"> ;
pg:source swh:<xsl:value-of select="$pluglabel"/>-<xsl:value-of select="@source"/></xsl:if> .
</xsl:for-each>
swh:<xsl:value-of select="$pluglabel"/> a :Plugin ;
<xsl:call-template name="csl2type">
<xsl:with-param name="in" select="@class"/>
</xsl:call-template>
doap:name "<xsl:value-of select="name"/>" ;
doap:maintainer [
foaf:name "Steve Harris";
foaf:homepage <http://plugin.org.uk/> ;
foaf:mbox <mailto:steve@plugin.org.uk> ;
] ;
doap:license <http://usefulinc.com/doap/licenses/gpl> ;
:documentation <http://plugin.org.uk/ladspa-swh/docs/ladspa-swh.html#<xsl:value-of select="@label"/>> ;
<!-- <xsl:if test="p">swhext:documentation """<xsl:value-of select="p"/>""" ;
</xsl:if>-->
<xsl:for-each select="/ladspa/global/meta">
<xsl:if test="@name = 'properties' and @value = 'HARD_RT_CAPABLE'">
:pluginProperty :hardRtCapable ;
</xsl:if>
</xsl:for-each>
<xsl:for-each select="port">
:port [
a :<xsl:if test="@dir = 'input'">InputPort</xsl:if><xsl:if test="@dir = 'output'">OutputPort</xsl:if>, :<xsl:if test="@type = 'control'">ControlPort</xsl:if><xsl:if test="@type = 'audio'">AudioPort</xsl:if> ;
:name "<xsl:value-of select="name"/>" ;
:index <xsl:number value="position()-1" format="1" /> ;
:symbol "<xsl:value-of select="@label"/>" ;<xsl:for-each select="range">
:minimum <xsl:value-of select="@min"/> ;
:maximum <xsl:value-of select="@max"/> ;</xsl:for-each>
<xsl:if test="@label = 'latency'">
:portProperty :reportsLatency ;</xsl:if>
<xsl:if test="contains(@hint, 'default_0')">
:default 0.0 ;</xsl:if>
<xsl:if test="contains(@hint, 'default_1')">
:default 1.0 ;</xsl:if>
<xsl:if test="contains(@hint, 'default_440')">
:default 440.0 ;</xsl:if>
<xsl:if test="contains(@hint, 'default_high')">
:default <xsl:value-of select="(number(range/@max) * 3.0 + number(range/@min)) div 4.0"/> ;</xsl:if>
<xsl:if test="contains(@hint, 'default_high')">
:default <xsl:value-of select="(3.0 * number(range/@max) + number(range/@min)) div 4.0"/> ;</xsl:if>
<xsl:if test="contains(@hint, 'default_low')">
:default <xsl:value-of select="(3.0 * number(range/@min) + number(range/@max)) div 4.0"/> ;</xsl:if>
<xsl:if test="contains(@hint, 'default_middle')">
:default <xsl:value-of select="(number(range/@min) + number(range/@max)) div 2.0"/> ;</xsl:if>
<xsl:if test="contains(@hint, 'default_minimum')">
:default <xsl:value-of select="range/@min"/> ;</xsl:if>
<xsl:if test="contains(@hint, 'default_maximum')">
:default <xsl:value-of select="range/@max"/> ;</xsl:if>
<xsl:if test="range/@default">
:default <xsl:value-of select="range/@default"/> ;</xsl:if>
<xsl:if test="contains(@hint, 'integer')">
:portProperty :integer ;</xsl:if>
<xsl:if test="contains(@hint, 'logarithmic')">
:portProperty pprops:logarithmic ;</xsl:if>
<xsl:if test="contains(@hint, 'sample_rate')">
:portProperty :sampleRate ;</xsl:if>
<xsl:if test="contains(@hint, 'toggled')">
:portProperty :toggled ;</xsl:if>
<xsl:if test="@group">
pg:inGroup swh:<xsl:value-of select="$pluglabel"/>-<xsl:value-of select="@group"/> ;
pg:role pg:<xsl:value-of select="@role"/> ;</xsl:if>
<!-- <xsl:if test="p">
swhext:documentation """<xsl:value-of select="p"/>""" ;</xsl:if>-->
] ;
</xsl:for-each>
<xsl:if test="/ladspa/global/code">
swhext:code """<xsl:value-of select="/ladspa/global/code"/>""" ;
</xsl:if>
<xsl:for-each select="callback">
swhext:callback [
swhext:event "<xsl:value-of select="@event"/>" ;
swhext:code """<xsl:value-of select="."/>""" ;
] ;
</xsl:for-each>
swhext:createdBy <http://plugin.org.uk/swh-plugins/toTurtle.xsl> .
</xsl:for-each>
</xsl:template>
<xsl:template name="csl2type">
<xsl:param name="in"/>
<xsl:choose>
<xsl:when test="contains($in, ',')"> a :<xsl:value-of select="substring-before($in, ',')"/> ;
<xsl:call-template name="csl2type">
<xsl:with-param name="in" select="substring-after($in, ',')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise> a :<xsl:value-of select="$in"/> ;
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
|