xslt を使用して、適切にフォーマットされた XML 構造をテキスト ファイルから生成する必要があります。私は xslt 変換の初心者で、これは私にとって少し難しいようです。サンプル テキスト ファイルは次のとおりです。最初の部分を省略し、値を引用符で囲んで出力 xml ファイルにマップする必要があります。
Directory: sample/archive
Name: 20130613-T210002.TXT
---------------------------------------------------------------
"11FCK1GR0026" "G190" "FPB - OK Ship Pt" "A" "11" "XX" "02"
"11FCA1GR0034" "G980" "FPB -San Antonio" "A" "11" "XX" "02"
"11FCA1GR0034" "G160" "FPB -San Antonio" "A" "11" "XX" "02"
以下は、目的の出力 xml 形式です。
<Account>
<Action>A</Action> <!-- 3rd element in the row-->
<org>G190</org> <!-- 2nd element-->
<code>11FCK1GR002611XX</code> <!--concat(1st element, 4th element, 5th element)-->
<FiscalYear>2013</FiscalYear> <!--calculate fiscal year from current date -->
<Info>
<Action>A</Action> <!-- 3rd element in the row-->
<org>G190</org> <!-- 2nd element-->
<code>11FCK1GR002611XX</code><!--concat(1st element, 4th element, 5th element)-->
<Fieldlab>Acc1</Fieldlab> <!-- Static value-->
<FieldVal>11FCK1GR0026 </FieldVal> <!-- if field order is 1, map 1st element -->
<FieldOrd>1</FieldOrd> <!-- Static value-->
<Info>
<Info>
<Action>A</Action>
<org>G190</org>
<code>11FCK1GR002611XX</code>
<Fieldlab>Acc2</Fieldlab>
<FieldVal>11</FieldVal> <!-- if field order is 2, map 5th element -->
<FieldOrd>2</FieldOrd>
<Info>
<Info>
<Action>A</Action> <!-- 4th element in the row-->
<org>G190</org> <!-- 2nd element-->
<code>11FCK1GR002611XX</code>
<Fieldlab>Acc3</Fieldlab>
<FieldVal>xx</FieldVal> <!-- if field order is 3, map 6th element -->
<FieldOrd>3</FieldOrd>
<Info>
<Info>
<Action>A</Action> <!-- 4th element in the row-->
<org>G190</org> <!-- 2nd element-->
<code>11FCK1GR002611XX</code>
<Fieldlab>Acc4</Fieldlab>
<FieldVal>02</FieldVal> <!-- if field order is 4, map 7th element -->
<FieldOrd>4</FieldOrd>
<Info>
<Info>
<Action>A</Action> <!-- 4th element in the row-->
<org>G190</org> <!-- 2nd element-->
<code>11FCK1GR002611XX</code>
<Fieldlab>Acc5</Fieldlab>
<FieldVal>FPB - OK Ship Pt</FieldVal> <!-- if field order is 5, map 3rd element -->
<FieldOrd>5</FieldOrd>
<Info>
</Account>
<Account>
<Action>A</Action> <!-- 3rd element in the row-->
<org>G980</org> <!-- 2nd element-->
<code>111FCA1GR003411XX</code> <!--concat(1st element, 4th element, 5th element)-->
<FiscalYear>2013</FiscalYear>
<Info>
<Action>A</Action> <!-- 3rd element in the row-->
<org>G190</org> <!-- 2nd element-->
<code>111FCA1GR003411XX</code><!--concat(1st element, 4th element, 5th element)-->
<Fieldlab>Acc1</Fieldlab>
<FieldVal>11FCA1GR0034</FieldVal> <!-- if field order is 1, map 1st element -->
<FieldOrd>1</FieldOrd>
<Info>
<Info>
<Action>A</Action>
<org>G190</org>
<code>111FCA1GR003411XX</code>
<Fieldlab>Acc2</Fieldlab>
<FieldVal>11</FieldVal> <!-- if field order is 2, map 5th element -->
<FieldOrd>2</FieldOrd>
<Info>
<Info>
<Action>A</Action> <!-- 4th element in the row-->
<org>G190</org> <!-- 2nd element-->
<code>111FCA1GR003411XX</code>
<Fieldlab>Acc3</Fieldlab>
<FieldVal>xx</FieldVal> <!-- if field order is 3, map 6th element -->
<FieldOrd>3</FieldOrd>
<Info>
<Info>
<Action>A</Action> <!-- 4th element in the row-->
<org>G190</org> <!-- 2nd element-->
<code>111FCA1GR003411XX</code>
<Fieldlab>Acc4</Fieldlab>
<FieldVal>02</FieldVal> <!-- if field order is 4, map 7th element -->
<FieldOrd>4</FieldOrd>
<Info>
<Info>
<Action>A</Action> <!-- 4th element in the row-->
<org>G190</org> <!-- 2nd element-->
<code>111FCA1GR003411XX</code>
<Fieldlab>Acc5</Fieldlab>
<FieldVal>FPB -San Antonio</FieldVal> <!-- if field order is 5, map 3rd element -->
<FieldOrd>5</FieldOrd>
<Info>
</Account>
このファイルを生成するのを手伝ってくれる人はいますか。前もって感謝します!