私のxslはhttp://www.xmlper.com/で作業しています(他のstackoverflowコメントからの素晴らしいツールの推奨)。xsltproc(osx) "スタイルシートではなく、コンパイルエラーです"。 xmlとxslはどちらもオンラインツールで動作します
が、私は同じことを実行します(現在は非常にストリップダウン)私のMac OS XのコマンドラインでXML & XSL私が手に「コンパイルエラーを、ドキュメントはスタイルシートではありません」
が、それはバージョンの問題(出力です以下のxsltprocの)?私は最新のMac(10.7)と最新のxcode 4.2(xmlのlibなどを保証するために)を実行していますか? xslt v2.0をサポートしていないxsltprocについて何も見つかりませんでした。(私はv1.0に設定しようとしました - 違いはありません) 他のxsltプロセッサー(saxonなど)をダウンロードしようとしましたが、プログラムを実行させないでください。
誰かがこれを見つけて解決したことを願っています! おかげ
ベン
入力xmlファイル
<?xml version="1.0" encoding="utf-8"?>
<resultsfile>
<planset>
<voicemail_divert>
<cost_over_plan>0</cost_over_plan>
<this_txn_absolutely_cost_subtotal>0</this_txn_absolutely_cost_subtotal>
</voicemail_divert>
</planset>
</resultsfile>
XSL
<?xml version="1.0"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:output method="xml"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="cost_over_plan">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
<extracost_overplan_aspartoftotal>0</extracost_overplan_aspartoftotal>
<extraqty_overplan_aspartoftotal>0</extraqty_overplan_aspartoftotal>
</xsl:template>
</xsl:stylesheet>
エラー
$ xsltproc --debug --novalid --nonet f.xml add_extraqtyandcostfields.xsl
compilation error: file f.xml line 2 element resultsfile
xsltParseStylesheetProcess : document is not a stylesheet
バージョン情報
$ xsltproc -version
Using libxml 20703, libxslt 10124 and libexslt 813
xsltproc was compiled against libxml 20703, libxslt 10124 and libexslt 813
libxslt 10124 was compiled against libxml 20703
libexslt 813 was compiled against libxml 20703
'f.xml'と' add_extraqtyandcostfields.xsl'の位置をコマンドラインで入れ替えてみましたか? ( 'xsltproc --debug --novalid --nonet add_extraqtyandcostfields.xsl f.xml') –