Added a plugin to create cadstar netlist, using the new intermediate file.
fixed issues in pads-pcb xsl converter
This commit is contained in:
parent
d979a35d93
commit
c108af9841
|
@ -0,0 +1,111 @@
|
||||||
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
|
<!--XSL style sheet to EESCHEMA Generic Netlist Format to CADSTAR netlist format
|
||||||
|
Copyright (C) 2010, SoftPLC Corporation.
|
||||||
|
GPL v2.
|
||||||
|
|
||||||
|
How to use:
|
||||||
|
https://lists.launchpad.net/kicad-developers/msg05157.html
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!DOCTYPE xsl:stylesheet [
|
||||||
|
<!ENTITY nl "
"> <!--new line CR, LF -->
|
||||||
|
]>
|
||||||
|
|
||||||
|
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||||
|
<xsl:output method="text" omit-xml-declaration="yes" indent="no"/>
|
||||||
|
|
||||||
|
<!-- Netlist header -->
|
||||||
|
<xsl:template match="/export">
|
||||||
|
<xsl:text>.HEA&nl;</xsl:text>
|
||||||
|
<xsl:apply-templates select="design/date"/> <!-- Generate line .TIM <time> -->
|
||||||
|
<xsl:apply-templates select="design/tool"/> <!-- Generate line .APP <eeschema version> -->
|
||||||
|
<xsl:apply-templates select="components/comp"/> <!-- Generate list of components -->
|
||||||
|
<xsl:text>&nl;&nl;</xsl:text>
|
||||||
|
<xsl:apply-templates select="nets/net"/> <!-- Generate list of nets and connections -->
|
||||||
|
<xsl:text>&nl;.END&nl;</xsl:text>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<!-- Generate line .TIM 20/08/2010 10:45:33 -->
|
||||||
|
<xsl:template match="tool">
|
||||||
|
<xsl:text>.APP "</xsl:text>
|
||||||
|
<xsl:apply-templates/>
|
||||||
|
<xsl:text>"&nl;</xsl:text>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<!-- Generate line .APP "eeschema (2010-08-17 BZR 2450)-unstable" -->
|
||||||
|
<xsl:template match="date">
|
||||||
|
<xsl:text>.TIM </xsl:text>
|
||||||
|
<xsl:apply-templates/>
|
||||||
|
<xsl:text>&nl;</xsl:text>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<!-- for each component -->
|
||||||
|
<xsl:template match="comp">
|
||||||
|
<xsl:text>.ADD_COM </xsl:text>
|
||||||
|
<xsl:value-of select="@ref"/>
|
||||||
|
<xsl:text> </xsl:text>
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test = "value != '' ">
|
||||||
|
<xsl:text>"</xsl:text> <xsl:apply-templates select="value"/> <xsl:text>"</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:text>""</xsl:text>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
<xsl:text>&nl;</xsl:text>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<!-- for each net -->
|
||||||
|
<xsl:template match="net">
|
||||||
|
<!-- nets are output only if there is more than one pin in net -->
|
||||||
|
<xsl:if test="count(node)>1">
|
||||||
|
<xsl:variable name="netname">
|
||||||
|
<xsl:text>"</xsl:text>
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test = "@name != '' ">
|
||||||
|
<xsl:value-of select="@name"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:text>N-</xsl:text>
|
||||||
|
<xsl:value-of select="@code"/>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
<xsl:text>"&nl;</xsl:text>
|
||||||
|
</xsl:variable>
|
||||||
|
<xsl:apply-templates select="node" mode="first"/>
|
||||||
|
<xsl:value-of select="$netname"/>
|
||||||
|
<xsl:apply-templates select="node" mode="others"/>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<!-- for each node -->
|
||||||
|
<xsl:template match="node" mode="first">
|
||||||
|
<xsl:if test="position()=1">
|
||||||
|
<xsl:text>.ADD_TER </xsl:text>
|
||||||
|
<xsl:value-of select="@ref"/>
|
||||||
|
<xsl:text>.</xsl:text>
|
||||||
|
<xsl:value-of select="@pin"/>
|
||||||
|
<xsl:text> </xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="node" mode="others">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test='position()=1'>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:when test='position()=2'>
|
||||||
|
<xsl:text>.TER </xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:text> </xsl:text>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
<xsl:if test="position()>1">
|
||||||
|
<xsl:value-of select="@ref"/>
|
||||||
|
<xsl:text>.</xsl:text>
|
||||||
|
<xsl:value-of select="@pin"/>
|
||||||
|
<xsl:text>&nl;</xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
</xsl:stylesheet>
|
|
@ -19,6 +19,7 @@
|
||||||
<xsl:apply-templates select="components/comp"/>
|
<xsl:apply-templates select="components/comp"/>
|
||||||
<xsl:text>&nl;*NET*&nl;</xsl:text>
|
<xsl:text>&nl;*NET*&nl;</xsl:text>
|
||||||
<xsl:apply-templates select="nets/net"/>
|
<xsl:apply-templates select="nets/net"/>
|
||||||
|
<xsl:text>*END*&nl;</xsl:text>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<!-- for each component -->
|
<!-- for each component -->
|
||||||
|
@ -39,18 +40,21 @@
|
||||||
|
|
||||||
<!-- for each net -->
|
<!-- for each net -->
|
||||||
<xsl:template match="net">
|
<xsl:template match="net">
|
||||||
<xsl:text>*SIGNAL* </xsl:text>
|
<!-- nets are output only if there is more than one pin in net -->
|
||||||
<xsl:choose>
|
<xsl:if test="count(node)>1">
|
||||||
<xsl:when test = "@name != '' ">
|
<xsl:text>*SIGNAL* </xsl:text>
|
||||||
<xsl:value-of select="@name"/>
|
<xsl:choose>
|
||||||
</xsl:when>
|
<xsl:when test = "@name != '' ">
|
||||||
<xsl:otherwise>
|
<xsl:value-of select="@name"/>
|
||||||
<xsl:text>N-</xsl:text>
|
</xsl:when>
|
||||||
<xsl:value-of select="@code"/>
|
<xsl:otherwise>
|
||||||
</xsl:otherwise>
|
<xsl:text>N-</xsl:text>
|
||||||
</xsl:choose>
|
<xsl:value-of select="@code"/>
|
||||||
<xsl:text>&nl;</xsl:text>
|
</xsl:otherwise>
|
||||||
<xsl:apply-templates select="node"/>
|
</xsl:choose>
|
||||||
|
<xsl:text>&nl;</xsl:text>
|
||||||
|
<xsl:apply-templates select="node"/>
|
||||||
|
</xsl:if>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<!-- for each node -->
|
<!-- for each node -->
|
||||||
|
|
Loading…
Reference in New Issue