diff options
Diffstat (limited to 'eeschema/plugins/xsl_scripts')
-rw-r--r-- | eeschema/plugins/xsl_scripts/bom2csv.xsl | 99 | ||||
-rw-r--r-- | eeschema/plugins/xsl_scripts/bom2grouped_csv.xsl | 104 | ||||
-rw-r--r-- | eeschema/plugins/xsl_scripts/bom_with_title_block_2_csv.xsl | 167 | ||||
-rw-r--r-- | eeschema/plugins/xsl_scripts/netlist_form_OrcadPcb2.xsl | 210 | ||||
-rw-r--r-- | eeschema/plugins/xsl_scripts/netlist_form_cadstar-RINF.xsl | 131 | ||||
-rw-r--r-- | eeschema/plugins/xsl_scripts/netlist_form_cadstar.xsl | 123 | ||||
-rw-r--r-- | eeschema/plugins/xsl_scripts/netlist_form_pads-pcb.xsl | 69 |
7 files changed, 903 insertions, 0 deletions
diff --git a/eeschema/plugins/xsl_scripts/bom2csv.xsl b/eeschema/plugins/xsl_scripts/bom2csv.xsl new file mode 100644 index 0000000..67d588b --- /dev/null +++ b/eeschema/plugins/xsl_scripts/bom2csv.xsl @@ -0,0 +1,99 @@ +<!--XSL style sheet to convert EESCHEMA XML Partlist Format to CSV BOM Format + Copyright (C) 2013, Stefan Helmert. + GPL v2. + + Functionality: + Generation of csv table with table head of all existing field names + and correct assigned cell entries + + How to use this is explained in eeschema.pdf chapter 14. You enter a command line into the + netlist exporter using a new (custom) tab in the netlist export dialog. The command is + similar to + on Windows: + xsltproc -o "%O.csv" "C:\Program Files (x86)\KiCad\bin\plugins\bom2csv.xsl" "%I" + on Linux: + xsltproc -o "%O.csv" /usr/local/lib/kicad/plugins/bom2csv.xsl "%I" + + Instead of "%O.csv" you can alternatively use "%O" if you will supply your own file extension when + prompted in the UI. The double quotes are there to account for the possibility of space(s) + in the filename. +--> + +<!-- + @package + Generate a Tab delimited list (csv file type). + One component per line + Fields are + Ref,Value, Footprint, Datasheet, Field5, Field4, price + + Command line + xsltproc -o "%O.csv" "pathToFile/bom2csv.xsl" "%I" +--> + +<!DOCTYPE xsl:stylesheet [ + <!ENTITY nl "
"> <!--new line CR, LF, or LF, your choice --> +]> + + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> + <xsl:output method="text"/> + + <!-- for table head and empty table fields--> + <xsl:key name="headentr" match="field" use="@name"/> + + <!-- main part --> + <xsl:template match="/export"> + <xsl:text>Reference, Value, Footprint, Datasheet</xsl:text> + + <!-- find all existing table head entries and list each one once --> + <xsl:for-each select="components/comp/fields/field[generate-id(.) = generate-id(key('headentr',@name)[1])]"> + <xsl:text>, </xsl:text> + <xsl:value-of select="@name"/> + </xsl:for-each> + <xsl:text>&nl;</xsl:text> + + <!-- all table entries --> + <xsl:apply-templates select="components/comp"/> + </xsl:template> + + <!-- the table entries --> + <xsl:template match="components/comp"> + <xsl:text>"</xsl:text> + <xsl:value-of select="@ref"/><xsl:text>","</xsl:text> + <xsl:value-of select="value"/><xsl:text>","</xsl:text> + <xsl:value-of select="footprint"/><xsl:text>","</xsl:text> + <xsl:value-of select="datasheet"/><xsl:text>"</xsl:text> + <xsl:apply-templates select="fields"/> + <xsl:text>&nl;</xsl:text> + </xsl:template> + + <!-- table entries with dynamic table head --> + <xsl:template match="fields"> + + <!-- remember current fields section --> + <xsl:variable name="fieldvar" select="field"/> + + <!-- for all existing head entries --> + <xsl:for-each select="/export/components/comp/fields/field[generate-id(.) = generate-id(key('headentr',@name)[1])]"> + <xsl:variable name="allnames" select="@name"/> + <xsl:text>,"</xsl:text> + + <!-- for all field entries in the remembered fields section --> + <xsl:for-each select="$fieldvar"> + + <!-- only if this field entry exists in this fields section --> + <xsl:if test="@name=$allnames"> + <!-- content of the field --> + <xsl:value-of select="."/> + </xsl:if> + <!-- + If it does not exist, use an empty cell in output for this row. + Every non-blank entry is assigned to its proper column. + --> + </xsl:for-each> + + <xsl:text>"</xsl:text> + </xsl:for-each> + </xsl:template> + + </xsl:stylesheet> diff --git a/eeschema/plugins/xsl_scripts/bom2grouped_csv.xsl b/eeschema/plugins/xsl_scripts/bom2grouped_csv.xsl new file mode 100644 index 0000000..e9b8446 --- /dev/null +++ b/eeschema/plugins/xsl_scripts/bom2grouped_csv.xsl @@ -0,0 +1,104 @@ +<!--XSL style sheet to convert EESCHEMA XML Partlist Format to grouped CSV BOM Format + Copyright (C) 2014, Wolf Walter. + Copyright (C) 2013, Stefan Helmert. + GPL v2. + + Functionality: + Generation of Digi-Key ordering system compatible BOM + + How to use this is explained in eeschema.pdf chapter 14. You enter a command line into the + netlist exporter using a new (custom) tab in the netlist export dialog. + The command line is + xsltproc -o "%O.csv" "FullPathToFile/bom2groupedCsv.xsl" "%I" +--> +<!-- + @package + Functionality: + * Generate a comma separated value BOM list (csv file type). + * Components are sorted by ref and grouped by same value+footprint + One value per line + Fields are + Reference, Quantity, Value, Footprint, Datasheet + + The command line is + xsltproc -o "%O.csv" "FullPathToFile/bom2groupedCsv.xsl" "%I" +--> + + +<!DOCTYPE xsl:stylesheet [ + <!ENTITY nl "
"> <!--new line CR, LF, or LF, your choice --> +]> + + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> + <xsl:output method="text"/> + + <!-- for Muenchian grouping of footprint and value combination --> + <xsl:key name="partTypeByValueAndFootprint" match="comp" use="concat(footprint, '-', value)" /> + + <!-- for table head and empty table fields--> + <xsl:key name="headentr" match="field" use="@name"/> + + <!-- main part --> + <xsl:template match="/export"> + <xsl:text>Reference, Quantity, Value, Footprint, Datasheet</xsl:text> + + <!-- find all existing table head entries and list each one once --> + <xsl:for-each select="components/comp/fields/field[generate-id(.) = generate-id(key('headentr',@name)[1])]"> + <xsl:text>, </xsl:text> + <xsl:value-of select="@name"/> + </xsl:for-each> + + <!-- all table entries --> + <xsl:apply-templates select="components"/> + </xsl:template> + + <xsl:template match="components"> + <!-- for Muenchian grouping of footprint and value combination --> + <xsl:for-each select="comp[count(. | key('partTypeByValueAndFootprint', concat(footprint, '-', value))[1]) = 1]"> + <xsl:sort select="@ref" /> + <xsl:text>&nl;</xsl:text> + <!-- list of all references --> + <xsl:for-each select="key('partTypeByValueAndFootprint', concat(footprint, '-', value))"> + <xsl:sort select="@ref" /> + <xsl:value-of select="@ref"/><xsl:text> </xsl:text> + </xsl:for-each><xsl:text>,</xsl:text> + <!-- quantity of parts with same footprint and value --> + <xsl:value-of select="count(key('partTypeByValueAndFootprint', concat(footprint, '-', value)))"/><xsl:text>,</xsl:text> + <xsl:text>"</xsl:text> + <xsl:value-of select="value"/><xsl:text>","</xsl:text> + <xsl:value-of select="footprint"/><xsl:text>","</xsl:text> + <xsl:value-of select="datasheet"/><xsl:text>"</xsl:text> + <xsl:apply-templates select="fields"/> + </xsl:for-each> + </xsl:template> + + <!-- table entries with dynamic table head --> + <xsl:template match="fields"> + + <!-- remember current fields section --> + <xsl:variable name="fieldvar" select="field"/> + + <!-- for all existing head entries --> + <xsl:for-each select="/export/components/comp/fields/field[generate-id(.) = generate-id(key('headentr',@name)[1])]"> + <xsl:variable name="allnames" select="@name"/> + <xsl:text>,"</xsl:text> + + <!-- for all field entries in the remembered fields section --> + <xsl:for-each select="$fieldvar"> + + <!-- only if this field entry exists in this fields section --> + <xsl:if test="@name=$allnames"> + <!-- content of the field --> + <xsl:value-of select="."/> + <xsl:text>"</xsl:text> + </xsl:if> + <!-- + If it does not exist, use an empty cell in output for this row. + Every non-blank entry is assigned to its proper column. + --> + </xsl:for-each> + </xsl:for-each> + </xsl:template> + + </xsl:stylesheet>
\ No newline at end of file diff --git a/eeschema/plugins/xsl_scripts/bom_with_title_block_2_csv.xsl b/eeschema/plugins/xsl_scripts/bom_with_title_block_2_csv.xsl new file mode 100644 index 0000000..feed1ce --- /dev/null +++ b/eeschema/plugins/xsl_scripts/bom_with_title_block_2_csv.xsl @@ -0,0 +1,167 @@ +<!-- + EESCHEMA BOM plugin. Creates BOM CSV files from the project net file. + Based on Stefan Helmert bom2csv.xsl + + Note: + The project infomation (i.e title, company and revision) is taken from the root sheet. + + Arthur: + Ronald Sousa HashDefineElectronics.com + + Ouput Example: + Source, + Kicad Rev, working director and file source + Generated Date, date this file was generated + + Title, the project's title + Company, the project's company + Rev, the project's revision + Date Source, project's issue date + Comment, This is comment 1 + Comment, This is comment 2 + Comment, This is comment 3 + Comment, This is comment 4 +--> +<!-- + @package + Output format + Reference, Value, Fields[n], Library, Library Ref + U1, PIC32MX, Fields[n], KicadLib, PIC + +Command line: + xsltproc -o "%O.csv" "pathToFile/bom2csv.xsl" "%I" +--> + +<!DOCTYPE xsl:stylesheet [ + <!ENTITY nl "
"> <!--new line CR, LF, or LF, your choice --> +]> + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> + <xsl:output method="text"/> + + <!-- for table head and empty table fields--> + <xsl:key name="headentr" match="field" use="@name"/> + + <!-- main part --> + <xsl:template match="/export"> + <xsl:text>Source,</xsl:text><xsl:value-of select="design/source"/><xsl:text>&nl;</xsl:text> + <xsl:text>Kicad Rev,</xsl:text><xsl:value-of select="design/tool"/><xsl:text>&nl;</xsl:text> + <xsl:text>Generated Date,</xsl:text><xsl:value-of select="design/date"/><xsl:text>&nl;</xsl:text> + + <xsl:text>&nl;</xsl:text> + + <!-- Ouput Root sheet project information --> + <xsl:apply-templates select="/export/design/sheet[1]"/> + + <xsl:text>&nl;</xsl:text> + + <!-- Output table header --> + <xsl:text>Reference,Value,</xsl:text> + <xsl:for-each select="components/comp/fields/field[generate-id(.) = generate-id(key('headentr',@name)[1])]"> + <xsl:value-of select="@name"/> + <xsl:text>,</xsl:text> + </xsl:for-each> + <xsl:text>Library,Library Ref</xsl:text> + <xsl:text>&nl;</xsl:text> + + <!-- all table entries --> + <xsl:apply-templates select="components/comp"/> + </xsl:template> + + <!-- generate the Root sheet project information --> + <xsl:template match="/export/design/sheet[1]"> + + <xsl:choose> + <xsl:when test="title_block/title !=''"> + <xsl:text>Title,</xsl:text><xsl:value-of select="title_block/title"/><xsl:text>&nl;</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>Title,Not Set</xsl:text><xsl:text>&nl;</xsl:text> + </xsl:otherwise> + </xsl:choose> + + + <xsl:choose> + <xsl:when test="title_block/company !=''"> + <xsl:text>Company,</xsl:text><xsl:value-of select="title_block/company"/><xsl:text>&nl;</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>Company,Not Set</xsl:text><xsl:text>&nl;</xsl:text> + </xsl:otherwise> + </xsl:choose> + + <xsl:choose> + <xsl:when test="title_block/rev !=''"> + <xsl:text>Revision,</xsl:text><xsl:value-of select="title_block/rev"/><xsl:text>&nl;</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>Revision,Not Set</xsl:text><xsl:text>&nl;</xsl:text> + </xsl:otherwise> + </xsl:choose> + + <xsl:choose> + <xsl:when test="title_block/date !=''"> + <xsl:text>Date Issue,</xsl:text><xsl:value-of select="title_block/date"/><xsl:text>&nl;</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>Date Issue,Not Set</xsl:text><xsl:text>&nl;</xsl:text> + </xsl:otherwise> + </xsl:choose> + + <xsl:apply-templates select="title_block/comment"/> + + </xsl:template> + + <xsl:template match="title_block/comment"> + <xsl:choose> + <xsl:when test="@value !=''"> + <xsl:text>Comment,</xsl:text><xsl:value-of select="@value"/><xsl:text>&nl;</xsl:text> + </xsl:when> + </xsl:choose> + </xsl:template> + + + + <!-- the table entries --> + <xsl:template match="components/comp"> + <xsl:value-of select="@ref"/><xsl:text>,</xsl:text> + <xsl:value-of select="value"/><xsl:text>,</xsl:text> + <xsl:apply-templates select="fields"/> + <xsl:apply-templates select="libsource"/> + <xsl:text>&nl;</xsl:text> + </xsl:template> + + <!-- the library selection --> + <xsl:template match="libsource"> + <xsl:value-of select="@lib"/><xsl:text>,</xsl:text> + <xsl:value-of select="@part"/> + </xsl:template> + + <!-- table entries with dynamic table head --> + <xsl:template match="fields"> + + <!-- remember current fields section --> + <xsl:variable name="fieldvar" select="field"/> + + <!-- for all existing head entries --> + <xsl:for-each select="/export/components/comp/fields/field[generate-id(.) = generate-id(key('headentr',@name)[1])]"> + <xsl:variable name="allnames" select="@name"/> + + <!-- for all field entries in the remembered fields section --> + <xsl:for-each select="$fieldvar"> + + <!-- only if this field entry exists in this fields section --> + <xsl:if test="@name=$allnames"> + <!-- content of the field --> + <xsl:value-of select="."/> + </xsl:if> + <!-- + If it does not exist, use an empty cell in output for this row. + Every non-blank entry is assigned to its proper column. + --> + </xsl:for-each> + <xsl:text>,</xsl:text> + </xsl:for-each> + </xsl:template> + + </xsl:stylesheet> diff --git a/eeschema/plugins/xsl_scripts/netlist_form_OrcadPcb2.xsl b/eeschema/plugins/xsl_scripts/netlist_form_OrcadPcb2.xsl new file mode 100644 index 0000000..3017711 --- /dev/null +++ b/eeschema/plugins/xsl_scripts/netlist_form_OrcadPcb2.xsl @@ -0,0 +1,210 @@ +<?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: + see eeschema.pdf, chapter 14 +--> + +<!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 + Creates the entire netlist + (can be seen as equivalent to main function in C +--> +<xsl:template match="/export"> + <xsl:text>( { EESchema Netlist Version 1.1 </xsl:text> + <!-- Generate line .TIM <time> --> + <xsl:apply-templates select="design/date"/> + <!-- Generate line eeschema version ... --> + <xsl:apply-templates select="design/tool"/> + <xsl:text>}&nl;</xsl:text> + + <!-- Generate the list of components --> + <xsl:apply-templates select="components/comp"/> <!-- Generate list of components --> + + <!-- end of file --> + <xsl:text>)&nl;*&nl;</xsl:text> +</xsl:template> + +<!-- + Generate id in header like "eeschema (2010-08-17 BZR 2450)-unstable" +--> +<xsl:template match="tool"> + <xsl:apply-templates/> +</xsl:template> + +<!-- + Generate date in header like "20/08/2010 10:45:33" +--> +<xsl:template match="date"> + <xsl:apply-templates/> + <xsl:text>&nl;</xsl:text> +</xsl:template> + +<!-- + This template read each component + (path = /export/components/comp) + creates lines: + ( 3EBF7DBD $noname U1 74LS125 + ... pin list ... + ) + and calls "create_pin_list" template to build the pin list +--> +<xsl:template match="comp"> + <xsl:text> ( </xsl:text> + <xsl:choose> + <xsl:when test = "tstamp != '' "> + <xsl:apply-templates select="tstamp"/> + </xsl:when> + <xsl:otherwise> + <xsl:text>00000000</xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:text> </xsl:text> + <xsl:choose> + <xsl:when test = "footprint != '' "> + <xsl:apply-templates select="footprint"/> + </xsl:when> + <xsl:otherwise> + <xsl:text>$noname</xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:text> </xsl:text> + <xsl:value-of select="@ref"/> + <xsl:text> </xsl:text> + <xsl:choose> + <xsl:when test = "value != '' "> + <xsl:apply-templates select="value"/> + </xsl:when> + <xsl:otherwise> + <xsl:text>"~"</xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:text>&nl;</xsl:text> + <xsl:call-template name="Search_pin_list" > + <xsl:with-param name="cmplib_id" select="libsource/@part"/> + <xsl:with-param name="cmp_ref" select="@ref"/> + </xsl:call-template> + <xsl:text> )&nl;</xsl:text> +</xsl:template> + +<!-- + This template search for a given lib component description in list + lib component descriptions are in /export/libparts, + and each description start at ./libpart + We search here for the list of pins of the given component + This template has 2 parameters: + "cmplib_id" (reference in libparts) + "cmp_ref" (schematic reference of the given component) +--> +<xsl:template name="Search_pin_list" > + <xsl:param name="cmplib_id" select="0" /> + <xsl:param name="cmp_ref" select="0" /> + <xsl:for-each select="/export/libparts/libpart"> + <xsl:if test = "@part = $cmplib_id "> + <xsl:apply-templates name="build_pin_list" select="pins/pin"> + <xsl:with-param name="cmp_ref" select="$cmp_ref"/> + </xsl:apply-templates> + </xsl:if> + </xsl:for-each> +</xsl:template> + + +<!-- + This template writes the pin list of a component + from the pin list of the library description + The pin list from library description is something like + <pins> + <pin num="1" type="passive"/> + <pin num="2" type="passive"/> + </pins> + Output pin list is ( <pin num> <net name> ) + something like + ( 1 VCC ) + ( 2 GND ) +--> +<xsl:template name="build_pin_list" match="pin"> + <xsl:param name="cmp_ref" select="0" /> + + <!-- write pin numner and separator --> + <xsl:text> ( </xsl:text> + <xsl:value-of select="@num"/> + <xsl:text> </xsl:text> + + <!-- search net name in nets section and write it: --> + <xsl:variable name="pinNum" select="@num" /> + <xsl:for-each select="/export/nets/net"> + <!-- net name is output only if there is more than one pin in net + else use "?" as net name, so count items in this net + --> + <xsl:variable name="pinCnt" select="count(node)" /> + <xsl:apply-templates name="Search_pin_netname" select="node"> + <xsl:with-param name="cmp_ref" select="$cmp_ref"/> + <xsl:with-param name="pin_cnt_in_net" select="$pinCnt"/> + <xsl:with-param name="pin_num"> <xsl:value-of select="$pinNum"/> + </xsl:with-param> + </xsl:apply-templates> + </xsl:for-each> + + <!-- close line --> + <xsl:text> )&nl;</xsl:text> +</xsl:template> + +<!-- + This template writes the pin netname of a given pin of a given component + from the nets list + The nets list description is something like + <nets> + <net code="1" name="GND"> + <node ref="J1" pin="20"/> + <node ref="C2" pin="2"/> + </net> + <net code="2" name=""> + <node ref="U2" pin="11"/> + </net> + </nets> + This template has 2 parameters: + "cmp_ref" (schematic reference of the given component) + "pin_num" (pin number) +--> + +<xsl:template name="Search_pin_netname" match="node"> + <xsl:param name="cmp_ref" select="0" /> + <xsl:param name="pin_num" select="0" /> + <xsl:param name="pin_cnt_in_net" select="0" /> + + <xsl:if test = "@ref = $cmp_ref "> + <xsl:if test = "@pin = $pin_num"> + <!-- net name is output only if there is more than one pin in net + else use "?" as net name + --> + <xsl:if test = "$pin_cnt_in_net>1"> + <xsl:choose> + <!-- if a net has a name, use it, + else build a name from its net code + --> + <xsl:when test = "../@name != '' "> + <xsl:value-of select="../@name"/> + </xsl:when> + <xsl:otherwise> + <xsl:text>$N-0</xsl:text><xsl:value-of select="../@code"/> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test = "$pin_cnt_in_net <2"> + <xsl:text>?</xsl:text> + </xsl:if> + </xsl:if> + </xsl:if> + +</xsl:template> + +</xsl:stylesheet> diff --git a/eeschema/plugins/xsl_scripts/netlist_form_cadstar-RINF.xsl b/eeschema/plugins/xsl_scripts/netlist_form_cadstar-RINF.xsl new file mode 100644 index 0000000..7df4b76 --- /dev/null +++ b/eeschema/plugins/xsl_scripts/netlist_form_cadstar-RINF.xsl @@ -0,0 +1,131 @@ +<?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: + see eeschema.pdf, chapter 14 +--> + +<!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:text>&nl;</xsl:text> + <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 .APP "eeschema (2010-08-17 BZR 2450)-unstable" --> +<xsl:template match="tool"> + <xsl:text>.APP "</xsl:text> + <xsl:apply-templates/> + <xsl:text>"&nl;</xsl:text> +</xsl:template> + + <!-- Generate line .TIM 20/08/2010 10:45:33 --> +<xsl:template match="date"> + <xsl:text>.TIM </xsl:text> + <xsl:apply-templates/> + <xsl:text>&nl;</xsl:text> +</xsl:template> + +<!-- for each component --> +<!-- create lines like + .ADD_COM U3 74LS541 (when no footprint name specified) + .ADD_COM JP1 CONN_8X2 pin_array_8x2 pin_array_8x2 (with a specified footprint name) +--> +<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:apply-templates select="value"/> + </xsl:when> + <xsl:otherwise> + <xsl:text>?</xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test = "footprint != '' "> + <xsl:text> </xsl:text> + <xsl:apply-templates select="footprint"/> + </xsl:when> + <xsl:otherwise> + </xsl:otherwise> + </xsl:choose> + <xsl:text>&nl;</xsl:text> +</xsl:template> + +<!-- for each net --> +<!-- create lines like +.ADD_TER U3.9 /PC-RST +.TER U3.8 + BUS1.2 +.ADD_TER BUS1.14 /PC-IOR +.TER U3.7 +--> +<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> diff --git a/eeschema/plugins/xsl_scripts/netlist_form_cadstar.xsl b/eeschema/plugins/xsl_scripts/netlist_form_cadstar.xsl new file mode 100644 index 0000000..0c72f53 --- /dev/null +++ b/eeschema/plugins/xsl_scripts/netlist_form_cadstar.xsl @@ -0,0 +1,123 @@ +<?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: + see eeschema.pdf, chapter 14 +--> + +<!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:text>&nl;</xsl:text> + <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 .APP "eeschema (2010-08-17 BZR 2450)-unstable" --> +<xsl:template match="tool"> + <xsl:text>.APP "</xsl:text> + <xsl:apply-templates/> + <xsl:text>"&nl;</xsl:text> +</xsl:template> + + <!-- Generate line .TIM 20/08/2010 10:45:33 --> +<xsl:template match="date"> + <xsl:text>.TIM </xsl:text> + <xsl:apply-templates/> + <xsl:text>&nl;</xsl:text> +</xsl:template> + +<!-- for each component --> +<!-- create lines like + .ADD_COM U3 "74LS541" (when no footprint name specified) + .ADD_COM JP1 "CONN_8X2" "pin_array_8x2" "pin_array_8x2" (with a specified footprint name) +--> +<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 --> +<!-- create lines like +.ADD_TER U3.9 "/PC-RST" +.TER U3.8 + BUS1.2 +.ADD_TER BUS1.14 "/PC-IOR" +.TER U3.7 +--> +<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> diff --git a/eeschema/plugins/xsl_scripts/netlist_form_pads-pcb.xsl b/eeschema/plugins/xsl_scripts/netlist_form_pads-pcb.xsl new file mode 100644 index 0000000..355072c --- /dev/null +++ b/eeschema/plugins/xsl_scripts/netlist_form_pads-pcb.xsl @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!--XSL style sheet to EESCHEMA Generic Netlist Format to PADS netlist format + Copyright (C) 2010, SoftPLC Corporation. + GPL v2. + + How to use: + see eeschema.pdf, chapter 14 +--> + +<!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"/> + +<xsl:template match="/export"> + <xsl:text>*PADS-PCB*&nl;*PART*&nl;</xsl:text> + <xsl:apply-templates select="components/comp"/> + <xsl:text>&nl;*NET*&nl;</xsl:text> + <xsl:apply-templates select="nets/net"/> + <xsl:text>*END*&nl;</xsl:text> +</xsl:template> + +<!-- for each component --> +<xsl:template match="comp"> + <xsl:text> </xsl:text> + <xsl:value-of select="@ref"/> + <xsl:text> </xsl:text> + <xsl:choose> + <xsl:when test = "footprint != '' "> + <xsl:apply-templates select="footprint"/> + </xsl:when> + <xsl:otherwise> + <xsl:text>unknown</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:text>*SIGNAL* </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:apply-templates select="node"/> + </xsl:if> +</xsl:template> + +<!-- for each node --> +<xsl:template match="node"> + <xsl:text> </xsl:text> + <xsl:value-of select="@ref"/> + <xsl:text>.</xsl:text> + <xsl:value-of select="@pin"/> + <xsl:text>&nl;</xsl:text> +</xsl:template> + +</xsl:stylesheet> |