「Eeschema Chapter14 JA」の版間の差分
 (writerでmediawiki形式でエクスポート)  | 
				 (仮翻訳)  | 
				||
| (同じ利用者による、間の1版が非表示) | |||
| 1行目: | 1行目: | ||
>>[[  | >>[[翻訳作業ページ?]] ([[Eeschema_Chapter13_JA|前ページ]])  | ||
=   | = ネットリストファイルと部品表(BOM)ファイルのカスタマイズ =  | ||
==   | == 中間ネットリスト ==  | ||
部品表ファイルとネットリストファイルは、Eeschemaが生成する中間ネットリストから変換されます。  | |||
このファイルはXMLフォーマットで書かれており、中間ネットリストと呼ばれています。この中間ネットリストはただのネットリストではありません。、部品表やさまざまなレポートを生成するため、設計中の基板に関する大量のデータが含まれているのです。  | |||
出力するファイル(部品表かネットリスト)次第で、中間ネットリストの利用される部分が変わってきます。  | |||
===   | === 回路図サンプル ===  | ||
[[Image:]]  | [[Image:]]  | ||
===   | === 中間ネットリストのサンプル ===  | ||
上記回路図に対応する中間ネットリスト(XML文法を利用しています)を以下に示します。  | |||
  <nowiki><?xml version="1.0" encoding="utf-8"?></nowiki>  |   <nowiki><?xml version="1.0" encoding="utf-8"?></nowiki>  | ||
| 198行目: | 197行目: | ||
  <nowiki></export></nowiki>  |   <nowiki></export></nowiki>  | ||
==   | == 新しいネットリスト形式への変換 ==  | ||
部品表ファイルや他形式のファイルへ変換するために、中間ネットリストファイルの内容を抽出していきます。これはテキスト形式のファイル操作であるため、この中間ネットリストからの情報抽出はPythonやXSLTを利用して簡単にプログラムを書くことができます。  | |||
XSLTはそれ自身がXML言語で書かれる、XMLファイルの処理に最適な言語です。XSLTを利用する場合、XsltprocプログラムがXMLの読み込み、スタイルシートの適用、フィルタの呼び出し、結果の保存に利用されます。Xsktoricを利用するためには、XSLTによる変換処理のためにスタイルシートを作成する必要があります。これら全ての変換プロセスは、Eeschemaにより透過的に処理されます。  | |||
==   | == XSLTのアプローチ ==  | ||
XSL変換(XSL Transformations : XSLT)に関するドキュメントは、下記より参照することが出来ます:  | |||
'''http://www.w3.org/TR/xslt'''  | '''http://www.w3.org/TR/xslt'''  | ||
===   | === Pads-Pcb形式ネットリストファイルの生成 ===  | ||
Pads-Pcb形式のネットリストは、下記の2セクションより構成されています。  | |||
*   | * フットプリントの一覧  | ||
*   | * ネットリスト:ネット情報によりグループ化された、パッド情報  | ||
以下に、中間ネットリストからPads-Pcb形式へ変換するためのスタイルシートを掲載します。  | |||
  <nowiki><?xml version="1.0" encoding="ISO-8859-1"?></nowiki>  |   <nowiki><?xml version="1.0" encoding="ISO-8859-1"?></nowiki>  | ||
| 220行目: | 219行目: | ||
      Copyright (C) 2010, SoftPLC Corporation.  |       Copyright (C) 2010, SoftPLC Corporation.  | ||
      GPL v2.  |       GPL v2.  | ||
      How to use:  |       How to use:  | ||
          https://lists.launchpad.net/kicad-developers/msg05157.html  |           https://lists.launchpad.net/kicad-developers/msg05157.html  | ||
  -->  |   -->  | ||
  <nowiki><!DOCTYPE xsl:stylesheet [</nowiki>  |   <nowiki><!DOCTYPE xsl:stylesheet [</nowiki>  | ||
    <nowiki><!ENTITY nl </nowiki> <nowiki>"
"> <!--new line CR, LF --></nowiki>  |     <nowiki><!ENTITY nl </nowiki> <nowiki>"
"> <!--new line CR, LF --></nowiki>  | ||
  ]>  |   ]>  | ||
  <nowiki><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"></nowiki>  |   <nowiki><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"></nowiki>  | ||
  <nowiki><xsl:output method="text" omit-xml-declaration="yes" indent="no"/></nowiki>  |   <nowiki><xsl:output method="text" omit-xml-declaration="yes" indent="no"/></nowiki>  | ||
  <nowiki><xsl:template match="/export"></nowiki>  |   <nowiki><xsl:template match="/export"></nowiki>  | ||
      <nowiki><xsl:text>*PADS-PCB*&nl;*PART*&nl;</xsl:text></nowiki>  |       <nowiki><xsl:text>*PADS-PCB*&nl;*PART*&nl;</xsl:text></nowiki>  | ||
| 239行目: | 238行目: | ||
      <nowiki><xsl:text>*END*&nl;</xsl:text></nowiki>  |       <nowiki><xsl:text>*END*&nl;</xsl:text></nowiki>  | ||
  <nowiki></xsl:template></nowiki>  |   <nowiki></xsl:template></nowiki>  | ||
  <nowiki><!-- for each component --></nowiki>  |   <nowiki><!-- for each component --></nowiki>  | ||
  <nowiki><xsl:template match="comp"></nowiki>  |   <nowiki><xsl:template match="comp"></nowiki>  | ||
| 255行目: | 254行目: | ||
      <nowiki><xsl:text>&nl;</xsl:text></nowiki>  |       <nowiki><xsl:text>&nl;</xsl:text></nowiki>  | ||
  <nowiki></xsl:template></nowiki>  |   <nowiki></xsl:template></nowiki>  | ||
  <nowiki><!-- for each net --></nowiki>  |   <nowiki><!-- for each net --></nowiki>  | ||
  <nowiki><xsl:template match="net"></nowiki>  |   <nowiki><xsl:template match="net"></nowiki>  | ||
| 274行目: | 273行目: | ||
      <nowiki></xsl:if></nowiki>  |       <nowiki></xsl:if></nowiki>  | ||
  <nowiki></xsl:template></nowiki>  |   <nowiki></xsl:template></nowiki>  | ||
  <nowiki><!-- for each node --></nowiki>  |   <nowiki><!-- for each node --></nowiki>  | ||
  <nowiki><xsl:template match="node"></nowiki>  |   <nowiki><xsl:template match="node"></nowiki>  | ||
| 283行目: | 282行目: | ||
      <nowiki><xsl:text>&nl;</xsl:text></nowiki>  |       <nowiki><xsl:text>&nl;</xsl:text></nowiki>  | ||
  <nowiki></xsl:template></nowiki>  |   <nowiki></xsl:template></nowiki>  | ||
  '''<nowiki></xsl:stylesheet></nowiki>'''  |   '''<nowiki></xsl:stylesheet></nowiki>'''  | ||
Xsltprocを実行し、出力されたファイルを以下に示します。  | |||
| 324行目: | 323行目: | ||
   P1.3  |    P1.3  | ||
  <nowiki>*END*</nowiki>  |   <nowiki>*END*</nowiki>  | ||
この変換は、次のコマンドラインにより実行することができます:  | |||
kicad/bin/xsltproc.exe -o test.net kicad/bin/plugins/netlist_form_pads-pcb.xsl test.tmp  | kicad/bin/xsltproc.exe -o test.net kicad/bin/plugins/netlist_form_pads-pcb.xsl test.tmp  | ||
===   | === Cadstar形式のネットリストファイルの生成 ===  | ||
Cadstar形式のネットリストは、下記の2セクションで構成されています。  | |||
*   | * フットプリントの一覧  | ||
*   | * ネットリスト:ネット情報によりグループ化された、パッド情報  | ||
以下に、中間ネットリストからPads-Pcb形式へ変換するためのスタイルシートを掲載します。  | |||
  ''<nowiki><?xml version="1.0" encoding="ISO-8859-1"?></nowiki>''  |   ''<nowiki><?xml version="1.0" encoding="ISO-8859-1"?></nowiki>''  | ||
| 343行目: | 342行目: | ||
      ''Copyright (C) 2010, SoftPLC Corporation.''  |       ''Copyright (C) 2010, SoftPLC Corporation.''  | ||
      ''GPL v2.''  |       ''GPL v2.''  | ||
  ''<nowiki><!DOCTYPE xsl:stylesheet [</nowiki>''  |   ''<nowiki><!DOCTYPE xsl:stylesheet [</nowiki>''  | ||
    ''<nowiki><!ENTITY nl </nowiki> <nowiki>"
"> <!--new line CR, LF --></nowiki>''  |     ''<nowiki><!ENTITY nl </nowiki> <nowiki>"
"> <!--new line CR, LF --></nowiki>''  | ||
  '']>''  |   '']>''    | ||
  ''<nowiki><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"></nowiki>''  |   ''<nowiki><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"></nowiki>''  | ||
  ''<nowiki><xsl:output method="text" omit-xml-declaration="yes" indent="no"/></nowiki>''  |   ''<nowiki><xsl:output method="text" omit-xml-declaration="yes" indent="no"/></nowiki>''  | ||
  ''<nowiki><!-- Netlist header --></nowiki>''  |   ''<nowiki><!-- Netlist header --></nowiki>''  | ||
  ''<nowiki><xsl:template match="/export"></nowiki>''  |   ''<nowiki><xsl:template match="/export"></nowiki>''  | ||
| 361行目: | 360行目: | ||
      ''<nowiki><xsl:text>&nl;.END&nl;</xsl:text></nowiki>''  |       ''<nowiki><xsl:text>&nl;.END&nl;</xsl:text></nowiki>''  | ||
  ''<nowiki></xsl:template></nowiki>''  |   ''<nowiki></xsl:template></nowiki>''  | ||
   ''<nowiki><!-- Generate line .TIM 20/08/2010 10:45:33 --></nowiki>''  |    ''<nowiki><!-- Generate line .TIM 20/08/2010 10:45:33 --></nowiki>''  | ||
  ''<nowiki><xsl:template match="tool"></nowiki>''  |   ''<nowiki><xsl:template match="tool"></nowiki>''  | ||
| 368行目: | 367行目: | ||
      ''<nowiki><xsl:text>"&nl;</xsl:text></nowiki>''  |       ''<nowiki><xsl:text>"&nl;</xsl:text></nowiki>''  | ||
  ''<nowiki></xsl:template></nowiki>''  |   ''<nowiki></xsl:template></nowiki>''  | ||
   ''<nowiki><!-- Generate line .APP "eeschema (2010-08-17 BZR 2450)-unstable" --></nowiki>''  |    ''<nowiki><!-- Generate line .APP "eeschema (2010-08-17 BZR 2450)-unstable" --></nowiki>''  | ||
  ''<nowiki><xsl:template match="date"></nowiki>''  |   ''<nowiki><xsl:template match="date"></nowiki>''  | ||
| 375行目: | 374行目: | ||
      ''<nowiki><xsl:text>&nl;</xsl:text></nowiki>''  |       ''<nowiki><xsl:text>&nl;</xsl:text></nowiki>''  | ||
  ''<nowiki></xsl:template></nowiki>''  |   ''<nowiki></xsl:template></nowiki>''  | ||
  ''<nowiki><!-- for each component --></nowiki>''  |   ''<nowiki><!-- for each component --></nowiki>''  | ||
  ''<nowiki><xsl:template match="comp"></nowiki>''  |   ''<nowiki><xsl:template match="comp"></nowiki>''  | ||
| 391行目: | 390行目: | ||
      ''<nowiki><xsl:text>&nl;</xsl:text></nowiki>''  |       ''<nowiki><xsl:text>&nl;</xsl:text></nowiki>''  | ||
  ''<nowiki></xsl:template></nowiki>''  |   ''<nowiki></xsl:template></nowiki>''  | ||
  ''<nowiki><!-- for each net --></nowiki>''  |   ''<nowiki><!-- for each net --></nowiki>''  | ||
  ''<nowiki><xsl:template match="net"></nowiki>''  |   ''<nowiki><xsl:template match="net"></nowiki>''  | ||
| 414行目: | 413行目: | ||
      ''<nowiki></xsl:if></nowiki>''  |       ''<nowiki></xsl:if></nowiki>''  | ||
  ''<nowiki></xsl:template></nowiki>''  |   ''<nowiki></xsl:template></nowiki>''  | ||
  ''<nowiki><!-- for each node --></nowiki>''  |   ''<nowiki><!-- for each node --></nowiki>''  | ||
  ''<nowiki><xsl:template match="node" mode="first"></nowiki>''  |   ''<nowiki><xsl:template match="node" mode="first"></nowiki>''  | ||
| 425行目: | 424行目: | ||
      ''<nowiki></xsl:if></nowiki>''  |       ''<nowiki></xsl:if></nowiki>''  | ||
  ''<nowiki></xsl:template></nowiki>''  |   ''<nowiki></xsl:template></nowiki>''  | ||
  ''<nowiki><xsl:template match="node" mode="others"></nowiki>''  |   ''<nowiki><xsl:template match="node" mode="others"></nowiki>''  | ||
      ''<nowiki><xsl:choose></nowiki>''  |       ''<nowiki><xsl:choose></nowiki>''  | ||
| 444行目: | 443行目: | ||
      ''<nowiki></xsl:if></nowiki>''  |       ''<nowiki></xsl:if></nowiki>''  | ||
  ''<nowiki></xsl:template></nowiki>''  |   ''<nowiki></xsl:template></nowiki>''  | ||
 ''<nowiki></xsl:stylesheet></nowiki>''  | |||
出力されたファイルを以下に示します。  | |||
  .HEA  |   .HEA  | ||
| 458行目: | 458行目: | ||
  .ADD_COM C1 "CP"  |   .ADD_COM C1 "CP"  | ||
  .ADD_COM R1 "R"  |   .ADD_COM R1 "R"  | ||
  .ADD_TER U1.7 "GND"  |   .ADD_TER U1.7 "GND"  | ||
  .TER     C1.2  |   .TER     C1.2  | ||
| 478行目: | 478行目: | ||
           U1.1  |            U1.1  | ||
           P1.3  |            P1.3  | ||
  .END  |   .END  | ||
===   | === OrcadPCB2形式ネットリストファイルの生成 ===  | ||
このフォーマットは、フットプリントの一覧のみで構成されています。それぞれのフットプリントは接続されるネットの情報を含みます。  | |||
変換を行うためのスタイルシートファイルを、以下に示します。  | |||
''<nowiki><!--XSL style sheet to EESCHEMA Generic Netlist Format to CADSTAR netlist format</nowiki>''  |  ''<nowiki><?xml version="1.0" encoding="ISO-8859-1"?></nowiki>''  | ||
''Copyright (C) 2010, SoftPLC Corporation.''  |  ''<nowiki><!--XSL style sheet to EESCHEMA Generic Netlist Format to CADSTAR netlist format</nowiki>''  | ||
''GPL v2.''  |  ''Copyright (C) 2010, SoftPLC Corporation.''  | ||
 ''GPL v2.''  | |||
''How to use:''  | |||
''https://lists.launchpad.net/kicad-developers/msg05157.html''  |  ''How to use:''  | ||
''-->''  |  ''https://lists.launchpad.net/kicad-developers/msg05157.html''  | ||
 ''-->''  | |||
''<nowiki><!DOCTYPE xsl:stylesheet [</nowiki>''  | |||
''<nowiki><!ENTITY nl </nowiki><nowiki>"
"> <!--new line CR, LF --></nowiki>''  |  ''<nowiki><!DOCTYPE xsl:stylesheet [</nowiki>''  | ||
'']>''  |  ''<nowiki><!ENTITY nl </nowiki><nowiki>"
"> <!--new line CR, LF --></nowiki>''  | ||
 '']>''  | |||
''<nowiki><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"></nowiki>''  | |||
''<nowiki><xsl:output method="text" omit-xml-declaration="yes" indent="no"/></nowiki>''  |  ''<nowiki><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"></nowiki>''  | ||
 ''<nowiki><xsl:output method="text" omit-xml-declaration="yes" indent="no"/></nowiki>''  | |||
''<nowiki><!--</nowiki>''  | |||
''Netlist header''  |  ''<nowiki><!--</nowiki>''  | ||
''Creates the entire netlist''  |  ''Netlist header''  | ||
''(can be seen as equivalent to main function in C''  |  ''Creates the entire netlist''  | ||
''-->''  |  ''(can be seen as equivalent to main function in C''  | ||
''<nowiki><xsl:template match="/export"></nowiki>''  |  ''-->''  | ||
''<nowiki><xsl:text>( { EESchema Netlist Version 1.1 </nowiki><nowiki></xsl:text></nowiki>''  |  ''<nowiki><xsl:template match="/export"></nowiki>''  | ||
''<nowiki><!-- Generate line .TIM <time> --></nowiki>''  |  ''<nowiki><xsl:text>( { EESchema Netlist Version 1.1 </nowiki><nowiki></xsl:text></nowiki>''  | ||
''<nowiki><xsl:apply-templates select="design/date"/></nowiki>''  |  ''<nowiki><!-- Generate line .TIM <time> --></nowiki>''  | ||
''<nowiki><!-- Generate line eeschema version ... --></nowiki>''  |  ''<nowiki><xsl:apply-templates select="design/date"/></nowiki>''  | ||
''<nowiki><xsl:apply-templates select="design/tool"/></nowiki>''  |  ''<nowiki><!-- Generate line eeschema version ... --></nowiki>''  | ||
''<nowiki><xsl:text>}&nl;</xsl:text></nowiki>''  |  ''<nowiki><xsl:apply-templates select="design/tool"/></nowiki>''  | ||
 ''<nowiki><xsl:text>}&nl;</xsl:text></nowiki>''  | |||
''<nowiki><!-- Generate the list of components --></nowiki>''  | |||
''<nowiki><xsl:apply-templates select="components/comp"/> </nowiki><nowiki><!-- Generate list of components --></nowiki>''  |  ''<nowiki><!-- Generate the list of components --></nowiki>''  | ||
 ''<nowiki><xsl:apply-templates select="components/comp"/> </nowiki><nowiki><!-- Generate list of components --></nowiki>''  | |||
''<nowiki><!-- end of file --></nowiki>''  | |||
''<nowiki><xsl:text>)&nl;*&nl;</xsl:text></nowiki>''  |  ''<nowiki><!-- end of file --></nowiki>''  | ||
''<nowiki></xsl:template></nowiki>''  |  ''<nowiki><xsl:text>)&nl;*&nl;</xsl:text></nowiki>''  | ||
 ''<nowiki></xsl:template></nowiki>''  | |||
''<nowiki><!--</nowiki>''  | |||
''Generate id in header like "eeschema (2010-08-17 BZR 2450)-unstable"''  |  ''<nowiki><!--</nowiki>''  | ||
''-->''  |  ''Generate id in header like "eeschema (2010-08-17 BZR 2450)-unstable"''  | ||
''<nowiki><xsl:template match="tool"></nowiki>''  |  ''-->''  | ||
''<nowiki><xsl:apply-templates/></nowiki>''  |  ''<nowiki><xsl:template match="tool"></nowiki>''  | ||
''<nowiki></xsl:template></nowiki>''  |  ''<nowiki><xsl:apply-templates/></nowiki>''  | ||
 ''<nowiki></xsl:template></nowiki>''  | |||
''<nowiki><!--</nowiki>''  | |||
''Generate date in header like "20/08/2010 10:45:33"''  |  ''<nowiki><!--</nowiki>''  | ||
''-->''  |  ''Generate date in header like "20/08/2010 10:45:33"''  | ||
''<nowiki><xsl:template match="date"></nowiki>''  |  ''-->''  | ||
''<nowiki><xsl:apply-templates/></nowiki>''  |  ''<nowiki><xsl:template match="date"></nowiki>''  | ||
''<nowiki><xsl:text>&nl;</xsl:text></nowiki>''  |  ''<nowiki><xsl:apply-templates/></nowiki>''  | ||
''<nowiki></xsl:template></nowiki>''  |  ''<nowiki><xsl:text>&nl;</xsl:text></nowiki>''  | ||
 ''<nowiki></xsl:template></nowiki>''  | |||
''<nowiki><!--</nowiki>''  | |||
''This template read each component''  |  ''<nowiki><!--</nowiki>''  | ||
''(path = /export/components/comp)''  |  ''This template read each component''  | ||
''creates lines:''  |  ''(path = /export/components/comp)''  | ||
''( 3EBF7DBD $noname U1 74LS125''  |  ''creates lines:''  | ||
''... pin list ...''  |  ''( 3EBF7DBD $noname U1 74LS125''  | ||
'')''  |  ''... pin list ...''  | ||
''and calls "create_pin_list" template to build the pin list''  |  '')''  | ||
''-->''  |  ''and calls "create_pin_list" template to build the pin list''  | ||
''<nowiki><xsl:template match="comp"></nowiki>''  |  ''-->''  | ||
''<nowiki><xsl:text> ( </xsl:text></nowiki>''  |  ''<nowiki><xsl:template match="comp"></nowiki>''  | ||
''<nowiki><xsl:choose></nowiki>''  |  ''<nowiki><xsl:text> ( </xsl:text></nowiki>''  | ||
''<nowiki><xsl:when test = "tstamp != '' "></nowiki>''  |  ''<nowiki><xsl:choose></nowiki>''  | ||
''<nowiki><xsl:apply-templates select="tstamp"/></nowiki>''  |  ''<nowiki><xsl:when test = "tstamp != '' "></nowiki>''  | ||
''<nowiki></xsl:when></nowiki>''  |  ''<nowiki><xsl:apply-templates select="tstamp"/></nowiki>''  | ||
''<nowiki><xsl:otherwise></nowiki>''  |  ''<nowiki></xsl:when></nowiki>''  | ||
''<nowiki><xsl:text>00000000</xsl:text></nowiki>''  |  ''<nowiki><xsl:otherwise></nowiki>''  | ||
''<nowiki></xsl:otherwise></nowiki>''  |  ''<nowiki><xsl:text>00000000</xsl:text></nowiki>''  | ||
 ''<nowiki></xsl:otherwise></nowiki>''  | |||
 ''<nowiki></xsl:choose></nowiki>''  | |||
 ''<nowiki><xsl:text> </xsl:text></nowiki>''  | |||
 ''<nowiki><xsl:choose></nowiki>''  | |||
 ''<nowiki><xsl:when test = "footprint != '' "></nowiki>''  | |||
 ''<nowiki><xsl:apply-templates select="footprint"/></nowiki>''  | |||
 ''<nowiki></xsl:when></nowiki>''  | |||
 ''<nowiki><xsl:otherwise></nowiki>''  | |||
 ''<nowiki><xsl:text>$noname</xsl:text></nowiki>''  | |||
 ''<nowiki></xsl:otherwise></nowiki>''  | |||
 ''<nowiki></xsl:choose></nowiki>''  | |||
 ''<nowiki><xsl:text> </xsl:text></nowiki>''  | |||
 ''<nowiki><xsl:value-of select="@ref"/></nowiki>''  | |||
 ''<nowiki><xsl:text> </xsl:text></nowiki>''  | |||
 ''<nowiki><xsl:choose></nowiki>''  | |||
 ''<nowiki><xsl:when test = "value != '' "></nowiki>''  | |||
 ''<nowiki><xsl:apply-templates select="value"/></nowiki>''  | |||
 ''<nowiki></xsl:when></nowiki>''  | |||
 ''<nowiki><xsl:otherwise></nowiki>''  | |||
 ''<nowiki><xsl:text>"~"</xsl:text></nowiki>''  | |||
 ''<nowiki></xsl:otherwise></nowiki>''  | |||
 ''<nowiki></xsl:choose></nowiki>''  | |||
 ''<nowiki><xsl:text>&nl;</xsl:text></nowiki>''  | |||
 ''<nowiki><xsl:call-template name="Search_pin_list" ></nowiki>''  | |||
 ''<nowiki><xsl:with-param name="cmplib_id" select="libsource/@part"/></nowiki>''  | |||
 ''<nowiki><xsl:with-param name="cmp_ref" select="@ref"/></nowiki>''  | |||
 ''<nowiki></xsl:call-template></nowiki>''  | |||
 ''<nowiki><xsl:text> )&nl;</xsl:text></nowiki>''  | |||
 ''<nowiki></xsl:template></nowiki>''  | |||
 ''<nowiki><!--</nowiki>''  | |||
 ''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)''  | |||
 ''-->''  | |||
 ''<nowiki><xsl:template name="Search_pin_list" ></nowiki>''  | |||
 ''<nowiki><xsl:param name="cmplib_id" select="0" /></nowiki>''  | |||
 ''<nowiki><xsl:param name="cmp_ref" select="0" /></nowiki>''  | |||
 ''<nowiki><xsl:for-each select="/export/libparts/libpart"></nowiki>''  | |||
 ''<nowiki><xsl:if test = "@part = $cmplib_id "></nowiki>''  | |||
 ''<nowiki><xsl:apply-templates name="build_pin_list" select="pins/pin"></nowiki>''  | |||
 ''<nowiki><xsl:with-param name="cmp_ref" select="$cmp_ref"/></nowiki>''  | |||
 ''<nowiki></xsl:apply-templates></nowiki>''  | |||
 ''<nowiki></xsl:if></nowiki>''  | |||
 ''<nowiki></xsl:for-each></nowiki>''  | |||
 ''<nowiki></xsl:template></nowiki>''  | |||
 ''<nowiki><!--</nowiki>''  | |||
 ''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''  | |||
 ''<nowiki><pins></nowiki>''  | |||
 ''<nowiki><pin num="1" type="passive"/></nowiki>''  | |||
 ''<nowiki><pin num="2" type="passive"/></nowiki>''  | |||
 ''<nowiki></pins></nowiki>''  | |||
 ''<nowiki>Output pin list is ( <pin num> <net name> )</nowiki>''  | |||
 ''something like''  | |||
 ''( 1 VCC )''  | |||
 ''( 2 GND )''  | |||
 ''-->''  | |||
 ''<nowiki><xsl:template name="build_pin_list" match="pin"></nowiki>''  | |||
 ''<nowiki><xsl:param name="cmp_ref" select="0" /></nowiki>''  | |||
 ''<nowiki><!-- write pin numner and separator --></nowiki>''  | |||
 ''<nowiki><xsl:text> </nowiki><nowiki>( </xsl:text></nowiki>''  | |||
 ''<nowiki><xsl:value-of select="@num"/></nowiki>''  | |||
 ''<nowiki><xsl:text> </xsl:text></nowiki>''  | |||
 ''<nowiki><!-- search net name in nets section and write it: --></nowiki>''  | |||
 ''<nowiki><xsl:variable name="pinNum" select="@num" /></nowiki>''  | |||
 ''<nowiki><xsl:for-each select="/export/nets/net"></nowiki>''  | |||
 ''<nowiki><!-- net name is output only if there is more than one pin in net</nowiki>''  | |||
 ''else use "?" as net name, so count items in this net''  | |||
 ''-->''  | |||
 ''<nowiki><xsl:variable name="pinCnt" select="count(node)" /></nowiki>''  | |||
 ''<nowiki><xsl:apply-templates name="Search_pin_netname" select="node"></nowiki>''  | |||
 ''<nowiki><xsl:with-param name="cmp_ref" select="$cmp_ref"/></nowiki>''  | |||
 ''<nowiki><xsl:with-param name="pin_cnt_in_net" select="$pinCnt"/></nowiki>''  | |||
 ''<nowiki><xsl:with-param name="pin_num"> <xsl:value-of select="$pinNum"/></nowiki>''  | |||
 ''<nowiki></xsl:with-param></nowiki>''  | |||
 ''<nowiki></xsl:apply-templates></nowiki>''  | |||
 ''<nowiki></xsl:for-each></nowiki>''  | |||
 ''<nowiki><!-- close line --></nowiki>''  | |||
 ''<nowiki><xsl:text> )&nl;</xsl:text></nowiki>''  | |||
 ''<nowiki></xsl:template></nowiki>''  | |||
 ''<nowiki><!--</nowiki>''  | |||
 ''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''  | |||
 ''<nowiki><nets></nowiki>''  | |||
 ''<nowiki><net code="1" name="GND"></nowiki>''  | |||
 ''<nowiki><node ref="J1" pin="20"/></nowiki>''  | |||
 ''<nowiki><node ref="C2" pin="2"/></nowiki>''  | |||
 ''<nowiki></net></nowiki>''  | |||
 ''<nowiki><net code="2" name=""></nowiki>''  | |||
 ''<nowiki><node ref="U2" pin="11"/></nowiki>''  | |||
 ''<nowiki></net></nowiki>''  | |||
 ''<nowiki></nets></nowiki>''  | |||
 ''This template has 2 parameters:''  | |||
 ''"cmp_ref" (schematic reference of the given component)''  | |||
 ''"pin_num" (pin number)''  | |||
 ''-->''  | |||
 ''<nowiki><xsl:template name="Search_pin_netname" match="node"></nowiki>''  | |||
 ''<nowiki><xsl:param name="cmp_ref" select="0" /></nowiki>''  | |||
 ''<nowiki><xsl:param name="pin_num" select="0" /></nowiki>''  | |||
 ''<nowiki><xsl:param name="pin_cnt_in_net" select="0" /></nowiki>''  | |||
 ''<nowiki><xsl:if test = "@ref = $cmp_ref "></nowiki>''  | |||
 ''<nowiki><xsl:if test = "@pin = $pin_num"></nowiki>''  | |||
 ''<nowiki><!-- net name is output only if there is more than one pin in net</nowiki>''  | |||
 ''else use "?" as net name''  | |||
 ''-->''  | |||
 ''<nowiki><xsl:if test = "$pin_cnt_in_net>1"></nowiki>''  | |||
 ''<nowiki><xsl:choose></nowiki>''  | |||
 ''<nowiki><!-- if a net has a name, use it,</nowiki>''  | |||
 ''else build a name from its net code''  | |||
 ''-->''  | |||
 ''<nowiki><xsl:when test = "../@name != '' "></nowiki>''  | |||
 ''<nowiki><xsl:value-of select="../@name"/></nowiki>''  | |||
 ''<nowiki></xsl:when></nowiki>''  | |||
 ''<nowiki><xsl:otherwise></nowiki>''  | |||
 ''<nowiki><xsl:text>$N-0</xsl:text><xsl:value-of select="../@code"/></nowiki>''  | |||
 ''<nowiki></xsl:otherwise></nowiki>''  | |||
 ''<nowiki></xsl:choose></nowiki>''  | |||
 ''<nowiki></xsl:if></nowiki>''  | |||
 ''<nowiki><xsl:if test = "$pin_cnt_in_net <2"></nowiki>''  | |||
 ''<nowiki><xsl:text>?</xsl:text></nowiki>''  | |||
 ''<nowiki></xsl:if></nowiki>''  | |||
 ''<nowiki></xsl:if></nowiki>''  | |||
 ''<nowiki></xsl:if></nowiki>''  | |||
 ''<nowiki></xsl:template></nowiki>''  | |||
 ''<nowiki></xsl:stylesheet></nowiki>''  | |||
出力されるファイルを、以下に示します。  | |||
  ( { EESchema Netlist Version 1.1  29/08/2010 21:07:51  |   ( { EESchema Netlist Version 1.1  29/08/2010 21:07:51  | ||
| 925行目: | 926行目: | ||
===   | === Eeschemaプラグインインタフェイス ===  | ||
中間ネットリストの変換はEeschemaの中で自動的に実行させることができます。  | |||
====   | ==== ダイアログウインドウの初期化 ====  | ||
「プラグインの追加」オプションより、ネットリストプラグインを追加することができます。  | |||
[[Image:]]  | [[Image:]]  | ||
PadsPcbプラグインのセットアップウインドウは、下記のようになります。  | |||
[[Image:]]  | [[Image:]]  | ||
中間ネットリストは、コンポーネントに関する全ての情報を持っているため、部品表はこの中間ネットリストから生成されます。カスタマイズされた部品表(BOM : Bill Of Material)ファイルを生成する為のプラグインセットアップウインドウを次に示します。  | |||
<center>[[Image:]]</center>  | <center>[[Image:]]</center>  | ||
====   | ==== 必要なパラメータ ====  | ||
The   | Eeschemaのプラグインインタフェイスは、次の情報を利用します。  | ||
* The title: ネットリストフォーマットの名前など  | |||
* 変換を行うためのコマンドライン  | |||
ネットリストボタンをクリックすると、次のように実行されます。  | |||
#   | # Eeschemaは''test.xml''のように*.xmlの形式で中間ネットリストを生成します。  | ||
#   | # Eeschemaはtest.xmlをプラグインへ入力し、test.netを生成します。  | ||
====   | ==== コマンドラインからのネットリストファイル生成 ====  | ||
''xsltproc.exe''を利用し中間ネットリストへスタイルシートを適用する場合、下記のコマンドにより''xsltproc.exe''が実行されます。  | |||
''<nowiki>xsltproc.exe -o <output filename> < style-sheet filename> <input XML file to convert></nowiki>''  | ''<nowiki>xsltproc.exe -o <output filename> < style-sheet filename> <input XML file to convert></nowiki>''  | ||
Windows環境でKicadを利用している場合のコマンドラインは以下のようになります。  | |||
''f:/kicad/bin/xsltproc.exe -o %O f:/kicad/bin/plugins/netlist_form_pads-pcb.xsl %I''  | ''f:/kicad/bin/xsltproc.exe -o %O f:/kicad/bin/plugins/netlist_form_pads-pcb.xsl %I''  | ||
Linux環境の場合のコマンドをいかに示します。  | |||
''xsltproc -o %O /usr/local/kicad/bin/plugins/netlist_form_pads-pcb.xsl %I''  | ''xsltproc -o %O /usr/local/kicad/bin/plugins/netlist_form_pads-pcb.xsl %I''  | ||
''netlist_form_pads-pcb.xsl''には、適用するスタイルシートのファイル名が入ります。このスタイルシートのパスにスペースが入っている場合には、ダブルクオーテーションで囲むのを忘れないようにしてください。  | |||
====   | ==== コマンドラインフォーマット ====  | ||
xsltprocのコマンドラインフォーマットを次に示します:  | |||
<nowiki><path of </nowiki>xsltproc> <nowiki>xsltproc <</nowiki>xsltproc parameters>  | <nowiki><path of </nowiki>xsltproc> <nowiki>xsltproc <</nowiki>xsltproc parameters>  | ||
サポートしているフォーマットに関するパラメータには、次のようなものがあります。  | |||
* %B => base filename and path of selected output file, minus path and extension.  | * %B => base filename and path of selected output file, minus path and extension.  | ||
* %I   | * %I => 入力ファイルの完全なパスとファイル名を指定します。  | ||
* %O =>   | * %O => 出力ファイルの完全なパスとファイル名を指定します。  | ||
%  | %Iは実際の中間ネットリストファイル名へ置換されます。  | ||
%  | %Oは実際の出力ファイル名へ置換され、最終的なネットリストファイルとなります。コマンドラインの例を次に示します:  | ||
''  | ''Wiindows環境の場合'''f:/kicad/bin/xsltproc.exe -o %O f:/kicad/bin/plugins/netlist_form_pads-pcb.xsl %I'''''  | ||
Linux環境の場合'''''xsltproc -o %O /usr/local/kicad/bin/plugins/netlist_form_pads-pcb.xsl %I'''''  | |||
==   | 上記は、xsltprocがWindows環境下でkicad/bin以下にインストールされていると仮定したものです。  | ||
== 中間ネットリストファイルの構造 ==  | |||
ネットリストファイルの例を次に示します。  | |||
  <nowiki><?xml version="1.0" encoding="utf-8"?></nowiki>  |   <nowiki><?xml version="1.0" encoding="utf-8"?></nowiki>  | ||
| 1,069行目: | 1,075行目: | ||
===   | === 通常のネットリストファイルの構造 ===  | ||
中間ネットリストファイルは、次の5セクションで構成されています。  | |||
*   | * ヘッダーセクション  | ||
*   | * コンポーネントセクション  | ||
*   | * ライブラリパーツセクション  | ||
*   | * ライブラリセクション  | ||
*   | * ネットセクション  | ||
<nowiki>  | <nowiki>このファイルは<export>タグで囲まれたものとなります。</nowiki>  | ||
| 1,085行目: | 1,091行目: | ||
  <nowiki></export></nowiki>  |   <nowiki></export></nowiki>  | ||
===   | === ヘッダーセクション ===  | ||
<nowiki>  | <nowiki>このヘッダは<design>タグで囲まれます。</nowiki>  | ||
| 1,095行目: | 1,101行目: | ||
    <nowiki></design></nowiki>  |     <nowiki></design></nowiki>  | ||
このセクションはコメントセクションとして捉えることができます。  | |||
===   | === コンポーネントセクション ===  | ||
<nowiki>  | <nowiki>このコンポーネントセクションは<components>タグで囲まれたものとなります。</nowiki>  | ||
    <nowiki><components></nowiki>  |     <nowiki><components></nowiki>  | ||
| 1,110行目: | 1,116行目: | ||
このセクションには、回路図中で使用されているコンポーネントの一覧が含まれます。それぞれのコンポーネントは、次のように記載されます。  | |||
      <nowiki><comp ref="P1"></nowiki>  |       <nowiki><comp ref="P1"></nowiki>  | ||
| 1,124行目: | 1,129行目: | ||
{| style="border-spacing:0;"  | {| style="border-spacing:0;"  | ||
| style="border-top:0.05pt solid #000000;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| '''libsource '''  | | style="border-top:0.05pt solid #000000;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| '''libsource '''  | ||
| style="border:0.05pt solid #000000;padding:0.097cm;"|   | | style="border:0.05pt solid #000000;padding:0.097cm;"| そのコンポーネントが含まれているライブラリ名  | ||
|-  | |-  | ||
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| '''part '''  | | style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| '''part '''  | ||
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"|   | | style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| ライブラリ中に登録されているコンポーネント名  | ||
|-  | |-  | ||
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| '''sheetpath '''  | | style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| '''sheetpath '''  | ||
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"|   | | style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| 階層内のシートのパス(回路図階層全体の中で、その回路図シートの位置を明確にするために利用される)  | ||
|-  | |-  | ||
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| '''tstamps (time stamps) '''  | | style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| '''tstamps (time stamps) '''  | ||
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"|   | | style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| 回路図ファイルのタイムスタンプ  | ||
|-  | |-  | ||
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| '''tstamp (time stamp) '''  | | style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| '''tstamp (time stamp) '''  | ||
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"|   | | style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| コンポーネントのタイムスタンプ  | ||
|}  | |}  | ||
====   | ==== コンポーネントのタイムスタンプに関する注意 ====  | ||
ネットリストやネットリストから生成される基板内でコンポーネントを識別するために、このタイムスタンプはそれぞれのコンポーネントで独自のものとする必要があります。  | |||
一方で、Kicadはコンポーネントを基板上の対応するフットプリントから識別する方法を用意しています。これは、回路図プロジェクト中のコンポーネントが再アノテーションされることと、コンポーネントとフットプリント間の結びつき情報を破壊しないために用意されたものです。  | |||
タイムスタンプはそれぞれのコンポーネントや回路図プロジェクト内のシートにおいて識別するための独自のものです。しかしながら、複雑な構造体で同じシートが複数回参照される場合などにおいては、同じタイムスタンプを持つコンポーネントが存在することとなってしまいます。  | |||
このような複雑な階層構造を持つシートでは、シートのパス情報を利用して個別のタイムスタンプを表現します。「そのシートのパス+タイムスタンプ」をコンポーネントのタイムスタンプとするのです。  | |||
===   | === ライブラリパーツセクション ===  | ||
<nowiki>  | <nowiki>このライブラリパーツセクションは、<libparts>タグで囲まれたものとなり、このセクションは回路図ライブラリの情報を定義するものとなります。このセクションは、次のものを含みます:</nowiki>  | ||
* <nowiki>  | |||
* <nowiki>  | * <nowiki><fp>で定義されるフットプリント名(名前にはワイルドカードが利用されます)</nowiki>  | ||
* <nowiki>  | * <nowiki><fields>で定義されるフィールド</nowiki>  | ||
* <nowiki><pins>で定義されるピン情報</nowiki>  | |||
    <nowiki><libparts></nowiki>  |     <nowiki><libparts></nowiki>  | ||
| 1,177行目: | 1,184行目: | ||
    <nowiki></libparts></nowiki>  |     <nowiki></libparts></nowiki>  | ||
<tt><nowiki><pin num="1" type="passive"/></nowiki></tt>のような行は、ピンの電気的な種類を定義するものです。有効なピンの種類は、次のものがあります。  | |||
{| style="border-spacing:0;"  | {| style="border-spacing:0;"  | ||
| style="border-top:0.05pt solid #000000;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Input  | | style="border-top:0.05pt solid #000000;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Input  | ||
| style="border:0.05pt solid #000000;padding:0.097cm;"|   | | style="border:0.05pt solid #000000;padding:0.097cm;"| 通常の入力  | ||
|-  | |-  | ||
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Output  | | style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Output  | ||
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"|   | | style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| 通常の出力  | ||
|-  | |-  | ||
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Bidirectional  | | style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Bidirectional  | ||
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"|   | | style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| 入力または出力  | ||
|-  | |-  | ||
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Tri-state  | | style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Tri-state  | ||
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"|   | | style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| バスの入出力  | ||
|-  | |-  | ||
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Passive  | | style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Passive  | ||
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"|   | | style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| 通常の受動部品のピン  | ||
|-  | |-  | ||
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Unspecified  | | style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Unspecified  | ||
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"|   | | style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| 不明な種類  | ||
|-  | |-  | ||
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Power input  | | style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Power input  | ||
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"|   | | style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| コンポーネントの電源入力  | ||
|-  | |-  | ||
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Power output  | | style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Power output  | ||
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"|   | | style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| レギュレータICのような部品の電源出力  | ||
|-  | |-  | ||
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Open collector  | | style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Open collector  | ||
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"|   | | style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| アナログコンパレータでよくみられるオープンコレクタ  | ||
|-  | |-  | ||
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Open emitter  | | style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Open emitter  | ||
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"|   | | style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| ロジックICでみられるオープンコレクタ  | ||
|-  | |-  | ||
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Not connected  | | style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Not connected  | ||
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"|   | | style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| 回路図上でオープンとすべきピン  | ||
|}  | |}  | ||
===   | === ライブラリセクション ===  | ||
<nowiki>  | <nowiki>ライブラリセクションは<libraries>タグで囲まれたものとなります。このセクションはプロジェクトから利用されているライブラリ情報を含みます。</nowiki>  | ||
    <nowiki><libraries></nowiki>  |     <nowiki><libraries></nowiki>  | ||
| 1,237行目: | 1,244行目: | ||
    <nowiki></libraries></nowiki>  |     <nowiki></libraries></nowiki>  | ||
===   | === ネットセクション ===  | ||
<nowiki>  | <nowiki>ネットセクションは<nets>タグで囲まれたものとなります。このセクションは、回路図上の接続情報を定義するものです。</nowiki>  | ||
| 1,258行目: | 1,265行目: | ||
    <nowiki></nets></nowiki>  |     <nowiki></nets></nowiki>  | ||
このセクションでは、回路図上の全てのネットを羅列します。  | |||
ネット情報の例を次に示します。  | |||
      <nowiki><net code="1" name="GND"></nowiki>  |       <nowiki><net code="1" name="GND"></nowiki>  | ||
| 1,272行目: | 1,280行目: | ||
{| style="border-spacing:0;"  | {| style="border-spacing:0;"  | ||
| style="border-top:0.05pt solid #000000;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| net code  | | style="border-top:0.05pt solid #000000;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| net code  | ||
| style="border:0.05pt solid #000000;padding:0.097cm;"|   | | style="border:0.05pt solid #000000;padding:0.097cm;"| ネットの内部的な識別番号  | ||
|-  | |-  | ||
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| name  | | style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| name  | ||
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"|   | | style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| ネット名  | ||
|-  | |-  | ||
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| node  | | style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| node  | ||
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"|   | | style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| ネットに接続されるピン  | ||
|}  | |}  | ||
==   | == xsltprocに関する追加情報 ==  | ||
次のページを参照してください: ''http://xmlsoft.org/XSLT/xsltproc.html''  | |||
===   | === はじめに ===  | ||
xsltprocはXSLTスタイルシートをXML文書に適用するためのコマンドラインツールです。これはGNOMEプロジェクトの一環として開発され、GNOMEデスクトップ環境無しでも利用することが可能です。  | |||
xsltprocはスタイルシート名と適用するファイル名をオプションとし、コマンドラインより起動されます。標準入力を利用する場合、ファイル名には - 記号を利用します。  | |||
スタイルシートがXML文書内に指示されている場合、コマンドラインでスタイルシート名を指示する必要はありません。xsltprocは自動的にスタイルシートを検出し利用します。標準では、出力が標準出力となっています。ファイルとして結果を出力したい場合には、 -o オプションを利用します。  | |||
===   | === コマンドライン ===  | ||
xsltproc<nowiki> [[-V] | [-v] | [-o </nowiki>''file''<nowiki>] | [--timing] | [--repeat] | [--debug] | [--novalid] | [--noout] | [--maxdepth </nowiki>''val''<nowiki>] | [--html] | [--param </nowiki>''name'' ''value''<nowiki>] | [--stringparam </nowiki>''name'' ''value''<nowiki>] | [--nonet] | [--path </nowiki>''paths''<nowiki>] | [--load-trace] | [--catalogs] | [--xinclude] | [--profile] | [--dumpextensions] | [--nowrite] | [--nomkdir] | [--writesubtree] | [--nodtdattr]] [</nowiki>''stylesheet''<nowiki>] [</nowiki>''file1''<nowiki>] [</nowiki>''file2''<nowiki>] [</nowiki>''....'']  | xsltproc<nowiki> [[-V] | [-v] | [-o </nowiki>''file''<nowiki>] | [--timing] | [--repeat] | [--debug] | [--novalid] | [--noout] | [--maxdepth </nowiki>''val''<nowiki>] | [--html] | [--param </nowiki>''name'' ''value''<nowiki>] | [--stringparam </nowiki>''name'' ''value''<nowiki>] | [--nonet] | [--path </nowiki>''paths''<nowiki>] | [--load-trace] | [--catalogs] | [--xinclude] | [--profile] | [--dumpextensions] | [--nowrite] | [--nomkdir] | [--writesubtree] | [--nodtdattr]] [</nowiki>''stylesheet''<nowiki>] [</nowiki>''file1''<nowiki>] [</nowiki>''file2''<nowiki>] [</nowiki>''....'']  | ||
===   | === コマンドラインオプション ===  | ||
<!-- 訳者注:以下は動作の確認をしておらず、直訳になってしまっている為、間違いがあるかもしれません。 -->  | |||
''-V 又は --version''  | |||
利用しているlibxmlとlibxsltのバージョン情報を表示します。  | |||
''-v 又は --verbose''  | |||
xsltprocがスタイルシートとドキュメントを処理する各段階でメッセージを出力します。  | |||
''-o 又は --output <ファイル名>''  | |||
''<ファイル名>''で指定されたファイルへ結果を出力します。「チャンク」などとして知られているように、複数出力したい場合は -o ディレクトリ名/ として指定したディレクトリへファイルを出力させます。この場合、ディレクトリは予め作成しておく必要があります。  | |||
''--timing''  | ''--timing''  | ||
スタイルシートの構文解析、ドキュメントの構文解析、スタイルシートの適用、結果の保存に掛かった時間を表示します。ミリ秒の単位で表示されます。  | |||
''--repeat''  | ''--repeat''  | ||
タイミングテストの為に、変換を20回繰り返し実行します。  | |||
''--debug''  | ''--debug''  | ||
デバッグの為に、変換されたドキュメントのXMLツリーを出力します。  | |||
''--novalid''  | ''--novalid''  | ||
ドキュメントのDTDの読み込みをスキップします。  | |||
''--noout''  | ''--noout''  | ||
結果を出力しません。  | |||
''--maxdepth <値>''  | |||
''--maxdepth   | |||
libxsltの無限ループを防ぐため、テンプレートの最大スタック深さを調整します。デフォルトは500です。  | |||
''--html''  | ''--html''  | ||
.   | |||
HTMLファイルを入力ファイルとします。  | |||
''--param <パラメータ名> <値>''  | |||
''--param   | |||
スタイルシート中の、パラメータで指定された''<パラメータ名>''および''<値>''の処理を行いません。パラメータ名と値のペアは、最大32個まで指定することができます。値をノードの識別ではなく、文字列として処理したい場合は、--stringparamオプションを利用してください。  | |||
''--stringparam   | ''--stringparam <パラメータ名> <値>''  | ||
''<パラメータ名>''と''<値>''で指定された値について、ノードの識別ではなく文字列として扱うようにします。(注:これら文字列はutf-8エンコードされている必要があります。)  | |||
''--nonet''  | ''--nonet''  | ||
DTDのエンティティやドキュメントをインターネットから取得しません。  | |||
''--path   | ''--path <パス>''  | ||
DTDやエンティティ、ドキュメントの読み込みに、''<パス>''で(半角スペースやカンマで区切られた)指定されたファイルのリストを使用します。  | |||
''--load-trace''  | ''--load-trace''  | ||
処理中に読み込まれた全てのドキュメントを、標準エラー出力へ出力します。  | |||
''--catalogs''  | ''--catalogs''  | ||
SGML_CATALOG_FILES内で指定されたSGMLカタログを外部エンティティの解決に利用します。標準では、xsltprocはXML_CATALOG_FILESで指定された場所を探します。XML_CATALOG_FILESが定義されていない場合、/etc/xml/catalogを利用します。  | |||
''--xinclude''  | |||
Xincludeの仕様に基づき、入力ドキュメントの処理を行います。Xincludeの詳細は、次を参照してください: [http://www.w3.org/TR/xinclude/ http://www.w3.org/TR/xinclude/]  | |||
''--profile 又は --norman''  | |||
スタイルシートのそれぞれのパーツの処理時に、プロファイル情報の詳細を出力します。これはスタイルシートのパフォーマンスを最適化するために利用できます。  | |||
''--dumpextensions''  | ''--dumpextensions''  | ||
登録済みの拡張子のリストを標準出力へ出力します。  | |||
''--nowrite''  | ''--nowrite''  | ||
ファイルやリソースへの書き込みを行いません。  | |||
''--nomkdir''  | ''--nomkdir''  | ||
ディレクトリを作成しません。  | |||
''--writesubtree <パス>''  | |||
''  | ''<パス>''で指定されたパス内のファイルのみ書込します。  | ||
''--nodtdattr ''  | ''--nodtdattr ''  | ||
ドキュメント内DTDの標準アトリビュートを適用しません。  | |||
=== Xsltprocの戻り値 ===  | |||
xsltprocはスクリプトからの呼び出し時などに利用しやすいよう、戻り値でステータスを返します。  | |||
===   | |||
0:   | 0: 通常  | ||
1:   | 1: 引数なし  | ||
2:   | 2: パラメータが多すぎる  | ||
3:   | 3: 不明なオプション  | ||
4:   | 4: スタイルシートの構文解析に失敗(parse error)  | ||
5:   | 5: スタイルシート内にエラー  | ||
6:   | 6: ドキュメントのひとつにエラー  | ||
7:   | 7: 未サポートのxsl : 出力メソッド  | ||
8:   | 8: 文字列パラメータがクオートとダブルクオーテーションの両方を含んでいる  | ||
9:   | 9: 内部処理エラー  | ||
10:   | 10: 中断シグナル(CTRL+Cなど)により処理を終了  | ||
11:   | 11: 出力ファイルに書き込めない  | ||
===   | === xsltprocに関する追加情報 ===  | ||
libxml   | libxml WEBページ: [http://www.xmlsoft.org/ http://www.xmlsoft.org/]  | ||
W3C XSLT   | W3C XSLT ページ: [http://www.w3.org/TR/xslt http://www.w3.org/TR/xslt]  | ||
2012年7月16日 (月) 01:14時点における最新版
ネットリストファイルと部品表(BOM)ファイルのカスタマイズ
中間ネットリスト
部品表ファイルとネットリストファイルは、Eeschemaが生成する中間ネットリストから変換されます。
このファイルはXMLフォーマットで書かれており、中間ネットリストと呼ばれています。この中間ネットリストはただのネットリストではありません。、部品表やさまざまなレポートを生成するため、設計中の基板に関する大量のデータが含まれているのです。
出力するファイル(部品表かネットリスト)次第で、中間ネットリストの利用される部分が変わってきます。
回路図サンプル
[[Image:]]
中間ネットリストのサンプル
上記回路図に対応する中間ネットリスト(XML文法を利用しています)を以下に示します。
<?xml version="1.0" encoding="utf-8"?>
<export version="D">
  <design>
    <source>F:\kicad_aux\netlist_test\netlist_test.sch</source>
    <date>29/08/2010 20:35:21</date>
    <tool>eeschema (2010-08-28 BZR 2458)-unstable</tool>
  </design>
  <components>
    <comp ref="P1">
      <value>CONN_4</value>
      <libsource lib="conn" part="CONN_4"/>
      <sheetpath names="/" tstamps="/"/>
      <tstamp>4C6E2141</tstamp>
    </comp>
    <comp ref="U2">
      <value>74LS74</value>
      <libsource lib="74xx" part="74LS74"/>
      <sheetpath names="/" tstamps="/"/>
      <tstamp>4C6E20BA</tstamp>
    </comp>
    <comp ref="U1">
      <value>74LS04</value>
      <libsource lib="74xx" part="74LS04"/>
      <sheetpath names="/" tstamps="/"/>
      <tstamp>4C6E20A6</tstamp>
    </comp>
    <comp ref="C1">
      <value>CP</value>
      <libsource lib="device" part="CP"/>
      <sheetpath names="/" tstamps="/"/>
      <tstamp>4C6E2094</tstamp>
    </comp>
    <comp ref="R1">
      <value>R</value>
      <libsource lib="device" part="R"/>
      <sheetpath names="/" tstamps="/"/>
      <tstamp>4C6E208A</tstamp>
    </comp>
  </components>
  <libparts>
    <libpart lib="device" part="C">
      <description>Condensateur non polarise</description>
      <footprints>
        <fp>SM*</fp>
        <fp>C?</fp>
        <fp>C1-1</fp>
      </footprints>
      <fields>
        <field name="Reference">C</field>
        <field name="Value">C</field>
      </fields>
      <pins>
        <pin num="1" name="~" type="passive"/>
        <pin num="2" name="~" type="passive"/>
      </pins>
    </libpart>
    <libpart lib="device" part="R">
      <description>Resistance</description>
      <footprints>
        <fp>R?</fp>
        <fp>SM0603</fp>
        <fp>SM0805</fp>
        <fp>R?-*</fp>
        <fp>SM1206</fp>
      </footprints>
      <fields>
        <field name="Reference">R</field>
        <field name="Value">R</field>
      </fields>
      <pins>
        <pin num="1" name="~" type="passive"/>
        <pin num="2" name="~" type="passive"/>
      </pins>
    </libpart>
    <libpart lib="conn" part="CONN_4">
      <description>Symbole general de connecteur</description>
      <fields>
        <field name="Reference">P</field>
        <field name="Value">CONN_4</field>
      </fields>
      <pins>
        <pin num="1" name="P1" type="passive"/>
        <pin num="2" name="P2" type="passive"/>
        <pin num="3" name="P3" type="passive"/>
        <pin num="4" name="P4" type="passive"/>
      </pins>
    </libpart>
    <libpart lib="74xx" part="74LS04">
      <description>Hex Inverseur</description>
      <fields>
        <field name="Reference">U</field>
        <field name="Value">74LS04</field>
      </fields>
      <pins>
        <pin num="1" name="~" type="input"/>
        <pin num="2" name="~" type="output"/>
        <pin num="3" name="~" type="input"/>
        <pin num="4" name="~" type="output"/>
        <pin num="5" name="~" type="input"/>
        <pin num="6" name="~" type="output"/>
        <pin num="7" name="GND" type="power_in"/>
        <pin num="8" name="~" type="output"/>
        <pin num="9" name="~" type="input"/>
        <pin num="10" name="~" type="output"/>
        <pin num="11" name="~" type="input"/>
        <pin num="12" name="~" type="output"/>
        <pin num="13" name="~" type="input"/>
        <pin num="14" name="VCC" type="power_in"/>
      </pins>
    </libpart>
    <libpart lib="74xx" part="74LS74">
      <description>Dual D FlipFlop, Set & Reset</description>
      <docs>74xx/74hc_hct74.pdf</docs>
      <fields>
        <field name="Reference">U</field>
        <field name="Value">74LS74</field>
      </fields>
      <pins>
        <pin num="1" name="Cd" type="input"/>
        <pin num="2" name="D" type="input"/>
        <pin num="3" name="Cp" type="input"/>
        <pin num="4" name="Sd" type="input"/>
        <pin num="5" name="Q" type="output"/>
        <pin num="6" name="~Q" type="output"/>
        <pin num="7" name="GND" type="power_in"/>
        <pin num="8" name="~Q" type="output"/>
        <pin num="9" name="Q" type="output"/>
        <pin num="10" name="Sd" type="input"/>
        <pin num="11" name="Cp" type="input"/>
        <pin num="12" name="D" type="input"/>
        <pin num="13" name="Cd" type="input"/>
        <pin num="14" name="VCC" type="power_in"/>
      </pins>
    </libpart>
  </libparts>
  <libraries>
    <library logical="device">
      <uri>F:\kicad\share\library\device.lib</uri>
    </library>
    <library logical="conn">
      <uri>F:\kicad\share\library\conn.lib</uri>
    </library>
    <library logical="74xx">
      <uri>F:\kicad\share\library\74xx.lib</uri>
    </library>
  </libraries>
  <nets>
    <net code="1" name="GND">
      <node ref="U1" pin="7"/>
      <node ref="C1" pin="2"/>
      <node ref="U2" pin="7"/>
      <node ref="P1" pin="4"/>
    </net>
    <net code="2" name="VCC">
      <node ref="R1" pin="1"/>
      <node ref="U1" pin="14"/>
      <node ref="U2" pin="4"/>
      <node ref="U2" pin="1"/>
      <node ref="U2" pin="14"/>
      <node ref="P1" pin="1"/>
    </net>
    <net code="3" name="">
      <node ref="U2" pin="6"/>
    </net>
    <net code="4" name="">
      <node ref="U1" pin="2"/>
      <node ref="U2" pin="3"/>
    </net>
    <net code="5" name="/SIG_OUT">
      <node ref="P1" pin="2"/>
      <node ref="U2" pin="5"/>
      <node ref="U2" pin="2"/>
    </net>
    <net code="6" name="/CLOCK_IN">
      <node ref="R1" pin="2"/>
      <node ref="C1" pin="1"/>
      <node ref="U1" pin="1"/>
      <node ref="P1" pin="3"/>
    </net>
  </nets>
</export>
新しいネットリスト形式への変換
部品表ファイルや他形式のファイルへ変換するために、中間ネットリストファイルの内容を抽出していきます。これはテキスト形式のファイル操作であるため、この中間ネットリストからの情報抽出はPythonやXSLTを利用して簡単にプログラムを書くことができます。
XSLTはそれ自身がXML言語で書かれる、XMLファイルの処理に最適な言語です。XSLTを利用する場合、XsltprocプログラムがXMLの読み込み、スタイルシートの適用、フィルタの呼び出し、結果の保存に利用されます。Xsktoricを利用するためには、XSLTによる変換処理のためにスタイルシートを作成する必要があります。これら全ての変換プロセスは、Eeschemaにより透過的に処理されます。
XSLTのアプローチ
XSL変換(XSL Transformations : XSLT)に関するドキュメントは、下記より参照することが出来ます:
Pads-Pcb形式ネットリストファイルの生成
Pads-Pcb形式のネットリストは、下記の2セクションより構成されています。
- フットプリントの一覧
 - ネットリスト:ネット情報によりグループ化された、パッド情報
 
以下に、中間ネットリストからPads-Pcb形式へ変換するためのスタイルシートを掲載します。
<?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:
        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"/>
<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>
Xsltprocを実行し、出力されたファイルを以下に示します。
*PADS-PCB* *PART* P1 unknown U2 unknown U1 unknown C1 unknown R1 unknown *NET* *SIGNAL* GND U1.7 C1.2 U2.7 P1.4 *SIGNAL* VCC R1.1 U1.14 U2.4 U2.1 U2.14 P1.1 *SIGNAL* N-4 U1.2 U2.3 *SIGNAL* /SIG_OUT P1.2 U2.5 U2.2 *SIGNAL* /CLOCK_IN R1.2 C1.1 U1.1 P1.3 *END*
この変換は、次のコマンドラインにより実行することができます:
kicad/bin/xsltproc.exe -o test.net kicad/bin/plugins/netlist_form_pads-pcb.xsl test.tmp
Cadstar形式のネットリストファイルの生成
Cadstar形式のネットリストは、下記の2セクションで構成されています。
- フットプリントの一覧
 - ネットリスト:ネット情報によりグループ化された、パッド情報
 
以下に、中間ネットリストからPads-Pcb形式へ変換するためのスタイルシートを掲載します。
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--XSL style sheet to EESCHEMA Generic Netlist Format to CADSTAR netlist format
    Copyright (C) 2010, Jean-Pierre Charras.
    Copyright (C) 2010, SoftPLC Corporation.
    GPL v2.
<!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>
出力されたファイルを以下に示します。
.HEA
.TIM 21/08/2010 08:12:08
.APP "eeschema (2010-08-09 BZR 2439)-unstable"
.ADD_COM P1 "CONN_4"
.ADD_COM U2 "74LS74"
.ADD_COM U1 "74LS04"
.ADD_COM C1 "CP"
.ADD_COM R1 "R"
.ADD_TER U1.7 "GND"
.TER     C1.2
         U2.7
         P1.4
.ADD_TER R1.1 "VCC"
.TER     U1.14
         U2.4
         U2.1
         U2.14
         P1.1
.ADD_TER U1.2 "N-4"
.TER     U2.3
.ADD_TER P1.2 "/SIG_OUT"
.TER     U2.5
         U2.2
.ADD_TER R1.2 "/CLOCK_IN"
.TER     C1.1
         U1.1
         P1.3
.END
OrcadPCB2形式ネットリストファイルの生成
このフォーマットは、フットプリントの一覧のみで構成されています。それぞれのフットプリントは接続されるネットの情報を含みます。
変換を行うためのスタイルシートファイルを、以下に示します。
<?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 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>
出力されるファイルを、以下に示します。
( { EESchema Netlist Version 1.1  29/08/2010 21:07:51
eeschema (2010-08-28 BZR 2458)-unstable}
 ( 4C6E2141 $noname P1 CONN_4
  (  1 VCC )
  (  2 /SIG_OUT )
  (  3 /CLOCK_IN )
  (  4 GND )
 )
 ( 4C6E20BA $noname U2 74LS74
  (  1 VCC )
  (  2 /SIG_OUT )
  (  3 N-04 )
  (  4 VCC )
  (  5 /SIG_OUT )
  (  6 ? )
  (  7 GND )
  (  14 VCC )
 )
 ( 4C6E20A6 $noname U1 74LS04
  (  1 /CLOCK_IN )
  (  2 N-04 )
  (  7 GND )
  (  14 VCC )
 )
 ( 4C6E2094 $noname C1 CP
  (  1 /CLOCK_IN )
  (  2 GND )
 )
 ( 4C6E208A $noname R1 R
  (  1 VCC )
  (  2 /CLOCK_IN )
 )
)
*
Eeschemaプラグインインタフェイス
中間ネットリストの変換はEeschemaの中で自動的に実行させることができます。
ダイアログウインドウの初期化
「プラグインの追加」オプションより、ネットリストプラグインを追加することができます。
[[Image:]]
PadsPcbプラグインのセットアップウインドウは、下記のようになります。
[[Image:]]
中間ネットリストは、コンポーネントに関する全ての情報を持っているため、部品表はこの中間ネットリストから生成されます。カスタマイズされた部品表(BOM : Bill Of Material)ファイルを生成する為のプラグインセットアップウインドウを次に示します。
必要なパラメータ
Eeschemaのプラグインインタフェイスは、次の情報を利用します。
- The title: ネットリストフォーマットの名前など
 - 変換を行うためのコマンドライン
 
ネットリストボタンをクリックすると、次のように実行されます。
- Eeschemaはtest.xmlのように*.xmlの形式で中間ネットリストを生成します。
 - Eeschemaはtest.xmlをプラグインへ入力し、test.netを生成します。
 
コマンドラインからのネットリストファイル生成
xsltproc.exeを利用し中間ネットリストへスタイルシートを適用する場合、下記のコマンドによりxsltproc.exeが実行されます。
xsltproc.exe -o <output filename> < style-sheet filename> <input XML file to convert>
Windows環境でKicadを利用している場合のコマンドラインは以下のようになります。
f:/kicad/bin/xsltproc.exe -o %O f:/kicad/bin/plugins/netlist_form_pads-pcb.xsl %I
Linux環境の場合のコマンドをいかに示します。
xsltproc -o %O /usr/local/kicad/bin/plugins/netlist_form_pads-pcb.xsl %I
netlist_form_pads-pcb.xslには、適用するスタイルシートのファイル名が入ります。このスタイルシートのパスにスペースが入っている場合には、ダブルクオーテーションで囲むのを忘れないようにしてください。
コマンドラインフォーマット
xsltprocのコマンドラインフォーマットを次に示します:
<path of xsltproc> xsltproc <xsltproc parameters>
サポートしているフォーマットに関するパラメータには、次のようなものがあります。
- %B => base filename and path of selected output file, minus path and extension.
 - %I => 入力ファイルの完全なパスとファイル名を指定します。
 - %O => 出力ファイルの完全なパスとファイル名を指定します。
 
%Iは実際の中間ネットリストファイル名へ置換されます。
%Oは実際の出力ファイル名へ置換され、最終的なネットリストファイルとなります。コマンドラインの例を次に示します:
Wiindows環境の場合f:/kicad/bin/xsltproc.exe -o %O f:/kicad/bin/plugins/netlist_form_pads-pcb.xsl %I
Linux環境の場合xsltproc -o %O /usr/local/kicad/bin/plugins/netlist_form_pads-pcb.xsl %I
上記は、xsltprocがWindows環境下でkicad/bin以下にインストールされていると仮定したものです。
中間ネットリストファイルの構造
ネットリストファイルの例を次に示します。
<?xml version="1.0" encoding="utf-8"?>
<export version="D">
  <design>
    <source>F:\kicad_aux\netlist_test\netlist_test.sch</source>
    <date>29/08/2010 21:07:51</date>
    <tool>eeschema (2010-08-28 BZR 2458)-unstable</tool>
  </design>
  <components>
    <comp ref="P1">
      <value>CONN_4</value>
      <libsource lib="conn" part="CONN_4"/>
      <sheetpath names="/" tstamps="/"/>
      <tstamp>4C6E2141</tstamp>
    </comp>
    <comp ref="U2">
      <value>74LS74</value>
      <libsource lib="74xx" part="74LS74"/>
      <sheetpath names="/" tstamps="/"/>
      <tstamp>4C6E20BA</tstamp>
    </comp>
    <comp ref="U1">
      <value>74LS04</value>
      <libsource lib="74xx" part="74LS04"/>
      <sheetpath names="/" tstamps="/"/>
      <tstamp>4C6E20A6</tstamp>
    </comp>
    <comp ref="C1">
      <value>CP</value>
      <libsource lib="device" part="CP"/>
      <sheetpath names="/" tstamps="/"/>
      <tstamp>4C6E2094</tstamp>
    <comp ref="R1">
      <value>R</value>
      <libsource lib="device" part="R"/>
      <sheetpath names="/" tstamps="/"/>
      <tstamp>4C6E208A</tstamp>
    </comp>
  </components>
  <libparts/>
  <libraries/>
  <nets>
    <net code="1" name="GND">
      <node ref="U1" pin="7"/>
      <node ref="C1" pin="2"/>
      <node ref="U2" pin="7"/>
      <node ref="P1" pin="4"/>
    </net>
    <net code="2" name="VCC">
      <node ref="R1" pin="1"/>
      <node ref="U1" pin="14"/>
      <node ref="U2" pin="4"/>
      <node ref="U2" pin="1"/>
      <node ref="U2" pin="14"/>
      <node ref="P1" pin="1"/>
    </net>
    <net code="3" name="">
      <node ref="U2" pin="6"/>
    </net>
    <net code="4" name="">
      <node ref="U1" pin="2"/>
      <node ref="U2" pin="3"/>
    </net>
    <net code="5" name="/SIG_OUT">
      <node ref="P1" pin="2"/>
      <node ref="U2" pin="5"/>
      <node ref="U2" pin="2"/>
    </net>
    <net code="6" name="/CLOCK_IN">
      <node ref="R1" pin="2"/>
      <node ref="C1" pin="1"/>
      <node ref="U1" pin="1"/>
      <node ref="P1" pin="3"/>
    </net>
  </nets>
</export>
通常のネットリストファイルの構造
中間ネットリストファイルは、次の5セクションで構成されています。
- ヘッダーセクション
 - コンポーネントセクション
 - ライブラリパーツセクション
 - ライブラリセクション
 - ネットセクション
 
このファイルは<export>タグで囲まれたものとなります。
<export version="D"> ... </export>
ヘッダーセクション
このヘッダは<design>タグで囲まれます。
  <design>
    <source>F:\kicad_aux\netlist_test\netlist_test.sch</source>
    <date>21/08/2010 08:12:08</date>
    <tool>eeschema (2010-08-09 BZR 2439)-unstable</tool>
  </design>
このセクションはコメントセクションとして捉えることができます。
コンポーネントセクション
このコンポーネントセクションは<components>タグで囲まれたものとなります。
  <components>
    <comp ref="P1">
      <value>CONN_4</value>
      <libsource lib="conn" part="CONN_4"/>
      <sheetpath names="/" tstamps="/"/>
      <tstamp>4C6E2141</tstamp>
    </comp>
  </components>
このセクションには、回路図中で使用されているコンポーネントの一覧が含まれます。それぞれのコンポーネントは、次のように記載されます。
    <comp ref="P1">
      <value>CONN_4</value>
      <libsource lib="conn" part="CONN_4"/>
      <sheetpath names="/" tstamps="/"/>
      <tstamp>4C6E2141</tstamp>
    </comp>
| libsource | そのコンポーネントが含まれているライブラリ名 | 
| part | ライブラリ中に登録されているコンポーネント名 | 
| sheetpath | 階層内のシートのパス(回路図階層全体の中で、その回路図シートの位置を明確にするために利用される) | 
| tstamps (time stamps) | 回路図ファイルのタイムスタンプ | 
| tstamp (time stamp) | コンポーネントのタイムスタンプ | 
コンポーネントのタイムスタンプに関する注意
ネットリストやネットリストから生成される基板内でコンポーネントを識別するために、このタイムスタンプはそれぞれのコンポーネントで独自のものとする必要があります。
一方で、Kicadはコンポーネントを基板上の対応するフットプリントから識別する方法を用意しています。これは、回路図プロジェクト中のコンポーネントが再アノテーションされることと、コンポーネントとフットプリント間の結びつき情報を破壊しないために用意されたものです。
タイムスタンプはそれぞれのコンポーネントや回路図プロジェクト内のシートにおいて識別するための独自のものです。しかしながら、複雑な構造体で同じシートが複数回参照される場合などにおいては、同じタイムスタンプを持つコンポーネントが存在することとなってしまいます。
このような複雑な階層構造を持つシートでは、シートのパス情報を利用して個別のタイムスタンプを表現します。「そのシートのパス+タイムスタンプ」をコンポーネントのタイムスタンプとするのです。
ライブラリパーツセクション
このライブラリパーツセクションは、<libparts>タグで囲まれたものとなり、このセクションは回路図ライブラリの情報を定義するものとなります。このセクションは、次のものを含みます:
- <fp>で定義されるフットプリント名(名前にはワイルドカードが利用されます)
 - <fields>で定義されるフィールド
 - <pins>で定義されるピン情報
 
  <libparts>
    <libpart lib="device" part="CP">
      <description>Condensateur polarise</description>
      <footprints>
        <fp>CP*</fp>
        <fp>SM*</fp>
      </footprints>
      <fields>
        <field name="Reference">C</field>
        <field name="Valeur">CP</field>
      </fields>
      <pins>
        <pin num="1" name="1" type="passive"/>
        <pin num="2" name="2" type="passive"/>
      </pins>
    </libpart>
  </libparts>
<pin num="1" type="passive"/>のような行は、ピンの電気的な種類を定義するものです。有効なピンの種類は、次のものがあります。
| Input | 通常の入力 | 
| Output | 通常の出力 | 
| Bidirectional | 入力または出力 | 
| Tri-state | バスの入出力 | 
| Passive | 通常の受動部品のピン | 
| Unspecified | 不明な種類 | 
| Power input | コンポーネントの電源入力 | 
| Power output | レギュレータICのような部品の電源出力 | 
| Open collector | アナログコンパレータでよくみられるオープンコレクタ | 
| Open emitter | ロジックICでみられるオープンコレクタ | 
| Not connected | 回路図上でオープンとすべきピン | 
ライブラリセクション
ライブラリセクションは<libraries>タグで囲まれたものとなります。このセクションはプロジェクトから利用されているライブラリ情報を含みます。
  <libraries>
    <library logical="device">
      <uri>F:\kicad\share\library\device.lib</uri>
    </library>
    <library logical="conn">
      <uri>F:\kicad\share\library\conn.lib</uri>
    </library>
  </libraries>
ネットセクション
ネットセクションは<nets>タグで囲まれたものとなります。このセクションは、回路図上の接続情報を定義するものです。
  <nets>
    <net code="1" name="GND">
      <node ref="U1" pin="7"/>
      <node ref="C1" pin="2"/>
      <node ref="U2" pin="7"/>
      <node ref="P1" pin="4"/>
    </net>
    <net code="2" name="VCC">
      <node ref="R1" pin="1"/>
      <node ref="U1" pin="14"/>
      <node ref="U2" pin="4"/>
      <node ref="U2" pin="1"/>
      <node ref="U2" pin="14"/>
      <node ref="P1" pin="1"/>
    </net>
  </nets>
このセクションでは、回路図上の全てのネットを羅列します。
ネット情報の例を次に示します。
    <net code="1" name="GND">
      <node ref="U1" pin="7"/>
      <node ref="C1" pin="2"/>
      <node ref="U2" pin="7"/>
      <node ref="P1" pin="4"/>
    </net>
| net code | ネットの内部的な識別番号 | 
| name | ネット名 | 
| node | ネットに接続されるピン | 
xsltprocに関する追加情報
次のページを参照してください: http://xmlsoft.org/XSLT/xsltproc.html
はじめに
xsltprocはXSLTスタイルシートをXML文書に適用するためのコマンドラインツールです。これはGNOMEプロジェクトの一環として開発され、GNOMEデスクトップ環境無しでも利用することが可能です。
xsltprocはスタイルシート名と適用するファイル名をオプションとし、コマンドラインより起動されます。標準入力を利用する場合、ファイル名には - 記号を利用します。
スタイルシートがXML文書内に指示されている場合、コマンドラインでスタイルシート名を指示する必要はありません。xsltprocは自動的にスタイルシートを検出し利用します。標準では、出力が標準出力となっています。ファイルとして結果を出力したい場合には、 -o オプションを利用します。
コマンドライン
xsltproc [[-V] | [-v] | [-o file] | [--timing] | [--repeat] | [--debug] | [--novalid] | [--noout] | [--maxdepth val] | [--html] | [--param name value] | [--stringparam name value] | [--nonet] | [--path paths] | [--load-trace] | [--catalogs] | [--xinclude] | [--profile] | [--dumpextensions] | [--nowrite] | [--nomkdir] | [--writesubtree] | [--nodtdattr]] [stylesheet] [file1] [file2] [....]
コマンドラインオプション
-V 又は --version
利用しているlibxmlとlibxsltのバージョン情報を表示します。
-v 又は --verbose
xsltprocがスタイルシートとドキュメントを処理する各段階でメッセージを出力します。
-o 又は --output <ファイル名>
<ファイル名>で指定されたファイルへ結果を出力します。「チャンク」などとして知られているように、複数出力したい場合は -o ディレクトリ名/ として指定したディレクトリへファイルを出力させます。この場合、ディレクトリは予め作成しておく必要があります。
--timing
スタイルシートの構文解析、ドキュメントの構文解析、スタイルシートの適用、結果の保存に掛かった時間を表示します。ミリ秒の単位で表示されます。
--repeat
タイミングテストの為に、変換を20回繰り返し実行します。
--debug
デバッグの為に、変換されたドキュメントのXMLツリーを出力します。
--novalid
ドキュメントのDTDの読み込みをスキップします。
--noout
結果を出力しません。
--maxdepth <値>
libxsltの無限ループを防ぐため、テンプレートの最大スタック深さを調整します。デフォルトは500です。
--html . HTMLファイルを入力ファイルとします。
--param <パラメータ名> <値>
スタイルシート中の、パラメータで指定された<パラメータ名>および<値>の処理を行いません。パラメータ名と値のペアは、最大32個まで指定することができます。値をノードの識別ではなく、文字列として処理したい場合は、--stringparamオプションを利用してください。
--stringparam <パラメータ名> <値>
<パラメータ名>と<値>で指定された値について、ノードの識別ではなく文字列として扱うようにします。(注:これら文字列はutf-8エンコードされている必要があります。)
--nonet
DTDのエンティティやドキュメントをインターネットから取得しません。
--path <パス>
DTDやエンティティ、ドキュメントの読み込みに、<パス>で(半角スペースやカンマで区切られた)指定されたファイルのリストを使用します。
--load-trace
処理中に読み込まれた全てのドキュメントを、標準エラー出力へ出力します。
--catalogs
SGML_CATALOG_FILES内で指定されたSGMLカタログを外部エンティティの解決に利用します。標準では、xsltprocはXML_CATALOG_FILESで指定された場所を探します。XML_CATALOG_FILESが定義されていない場合、/etc/xml/catalogを利用します。
--xinclude
Xincludeの仕様に基づき、入力ドキュメントの処理を行います。Xincludeの詳細は、次を参照してください: http://www.w3.org/TR/xinclude/
--profile 又は --norman
スタイルシートのそれぞれのパーツの処理時に、プロファイル情報の詳細を出力します。これはスタイルシートのパフォーマンスを最適化するために利用できます。
--dumpextensions
登録済みの拡張子のリストを標準出力へ出力します。
--nowrite
ファイルやリソースへの書き込みを行いません。
--nomkdir
ディレクトリを作成しません。
--writesubtree <パス>
<パス>で指定されたパス内のファイルのみ書込します。
--nodtdattr
ドキュメント内DTDの標準アトリビュートを適用しません。
Xsltprocの戻り値
xsltprocはスクリプトからの呼び出し時などに利用しやすいよう、戻り値でステータスを返します。
0: 通常
1: 引数なし
2: パラメータが多すぎる
3: 不明なオプション
4: スタイルシートの構文解析に失敗(parse error)
5: スタイルシート内にエラー
6: ドキュメントのひとつにエラー
7: 未サポートのxsl : 出力メソッド
8: 文字列パラメータがクオートとダブルクオーテーションの両方を含んでいる
9: 内部処理エラー
10: 中断シグナル(CTRL+Cなど)により処理を終了
11: 出力ファイルに書き込めない
xsltprocに関する追加情報
libxml WEBページ: http://www.xmlsoft.org/
W3C XSLT ページ: http://www.w3.org/TR/xslt