0

これは皆さんにとって複雑ではないかもしれませんが、私にとっては非常に困難です。これは私の2回目の試みです。データを変更して、変換にかかる時間が少ない情報を追加しました。

基本的に、私は3つの休暇プラン(VA、SS、WR)で構成されるデータを取得し、各プランが労働者ごとに1年間に各給与期間に発生する時間を予測しようとしています。データを短くするために、データには3つの支払い期間しか含めていません。労働者/発効日の組み合わせごとに個別の記録が必要です。したがって、労働者に3つの休暇計画があり、隔週(26回/年)で支払われる場合、その労働者は78のレコードを持つことができます。

これが私が始めているXMLです(私の例では最初の3つの支払い期間の日付のみを使用しており、26のすべてではないことを思い出してください):

 <?xml version='1.0' encoding='UTF-8'?>
<bb:Report_Data xmlns:bb="urn:com.workday.report/Projected_Balances_Outbound">
   <bb:Report_Entry>
      <bb:projectedBalanceTotal.principalId>1238974569</bb:projectedBalanceTotal.principalId>
      <bb:All_Eligible_Time_Off_Plans_for_Worker>
         <bb:projectedBalanceTotal.planCodeId>SS</bb:projectedBalanceTotal.planCodeId>
         <bb:projectedBalanceTotal.leaveCodeId>SS</bb:projectedBalanceTotal.leaveCodeId>
         <bb:projected_balance_accrual_amount_for_the_pay_period>3.323</bb:projected_balance_accrual_amount_for_the_pay_period>
         <bb:projectedBalanceTotal.effectiveDate1>07112012</bb:projectedBalanceTotal.effectiveDate1>
         <bb:projectedBalanceTotal.effectiveDate2>07252012</bb:projectedBalanceTotal.effectiveDate2>
         <bb:projectedBalanceTotal.effectiveDate3>08082012</bb:projectedBalanceTotal.effectiveDate3>

      </bb:All_Eligible_Time_Off_Plans_for_Worker>
      <bb:All_Eligible_Time_Off_Plans_for_Worker>
         <bb:projectedBalanceTotal.planCodeId>VA</bb:projectedBalanceTotal.planCodeId>
         <bb:projectedBalanceTotal.leaveCodeId>VA</bb:projectedBalanceTotal.leaveCodeId>
         <bb:projected_balance_accrual_amount_for_the_pay_period>0</bb:projected_balance_accrual_amount_for_the_pay_period>
         <bb:projectedBalanceTotal.effectiveDate1>07112012</bb:projectedBalanceTotal.effectiveDate1>
         <bb:projectedBalanceTotal.effectiveDate2>07252012</bb:projectedBalanceTotal.effectiveDate2>
         <bb:projectedBalanceTotal.effectiveDate3>08082012</bb:projectedBalanceTotal.effectiveDate3>

      </bb:All_Eligible_Time_Off_Plans_for_Worker>
      <bb:All_Eligible_Time_Off_Plans_for_Worker>
         <bb:projectedBalanceTotal.planCodeId>WR</bb:projectedBalanceTotal.planCodeId>
         <bb:projectedBalanceTotal.leaveCodeId>WR</bb:projectedBalanceTotal.leaveCodeId>
         <bb:projected_balance_accrual_amount_for_the_pay_period>0</bb:projected_balance_accrual_amount_for_the_pay_period>
         <bb:projectedBalanceTotal.effectiveDate1>07112012</bb:projectedBalanceTotal.effectiveDate1>
         <bb:projectedBalanceTotal.effectiveDate2>07252012</bb:projectedBalanceTotal.effectiveDate2>
         <bb:projectedBalanceTotal.effectiveDate3>08082012</bb:projectedBalanceTotal.effectiveDate3>

      </bb:All_Eligible_Time_Off_Plans_for_Worker>
      <bb:projectedBalanceTotal.employeeid>123454</bb:projectedBalanceTotal.employeeid>
   </bb:Report_Entry>
   <bb:Report_Entry>
      <bb:projectedBalanceTotal.principalId>4545645878</bb:projectedBalanceTotal.principalId>
      <bb:All_Eligible_Time_Off_Plans_for_Worker>
         <bb:projectedBalanceTotal.planCodeId>SS</bb:projectedBalanceTotal.planCodeId>
         <bb:projectedBalanceTotal.leaveCodeId>SS</bb:projectedBalanceTotal.leaveCodeId>
         <bb:projected_balance_accrual_amount_for_the_pay_period>3.692</bb:projected_balance_accrual_amount_for_the_pay_period>
         <bb:projectedBalanceTotal.effectiveDate1>07112012</bb:projectedBalanceTotal.effectiveDate1>
         <bb:projectedBalanceTotal.effectiveDate2>07252012</bb:projectedBalanceTotal.effectiveDate2>
         <bb:projectedBalanceTotal.effectiveDate3>08082012</bb:projectedBalanceTotal.effectiveDate3>

      </bb:All_Eligible_Time_Off_Plans_for_Worker>
      <bb:All_Eligible_Time_Off_Plans_for_Worker>
         <bb:projectedBalanceTotal.planCodeId>VA</bb:projectedBalanceTotal.planCodeId>
         <bb:projectedBalanceTotal.leaveCodeId>VA</bb:projectedBalanceTotal.leaveCodeId>
         <bb:projected_balance_accrual_amount_for_the_pay_period>0</bb:projected_balance_accrual_amount_for_the_pay_period>
         <bb:projectedBalanceTotal.effectiveDate1>07112012</bb:projectedBalanceTotal.effectiveDate1>
         <bb:projectedBalanceTotal.effectiveDate2>07252012</bb:projectedBalanceTotal.effectiveDate2>
         <bb:projectedBalanceTotal.effectiveDate3>08082012</bb:projectedBalanceTotal.effectiveDate3>

      </bb:All_Eligible_Time_Off_Plans_for_Worker>
      <bb:All_Eligible_Time_Off_Plans_for_Worker>
         <bb:projectedBalanceTotal.planCodeId>WR</bb:projectedBalanceTotal.planCodeId>
         <bb:projectedBalanceTotal.leaveCodeId>WR</bb:projectedBalanceTotal.leaveCodeId>
         <bb:projected_balance_accrual_amount_for_the_pay_period>0</bb:projected_balance_accrual_amount_for_the_pay_period>
         <bb:projectedBalanceTotal.effectiveDate1>07112012</bb:projectedBalanceTotal.effectiveDate1>
         <bb:projectedBalanceTotal.effectiveDate2>07252012</bb:projectedBalanceTotal.effectiveDate2>
         <bb:projectedBalanceTotal.effectiveDate3>08082012</bb:projectedBalanceTotal.effectiveDate3>

      </bb:All_Eligible_Time_Off_Plans_for_Worker>
      <bb:projectedBalanceTotal.employeeid>445241</bb:projectedBalanceTotal.employeeid>
   </bb:Report_Entry>
</bb:Report_Data>

これは、変換後に出力を表示するために必要なものです。

<?xml version='1.0' encoding='UTF-8'?>
<bb:Report_Data xmlns:bb="urn:com.workday.report/Projected_Balances_Outbound">
   <projectedBalanceTotal>
      <bb:projectedBalanceTotal.principalId>1238974569</bb:projectedBalanceTotal.principalId>
      <bb:projectedBalanceTotal.planCodeId>SS</bb:projectedBalanceTotal.planCodeId>
      <bb:projectedBalanceTotal.leaveCodeId>SS</bb:projectedBalanceTotal.leaveCodeId>
      <bb:projected_balance_accrual_amount_for_the_pay_period>3.323</bb:projected_balance_accrual_amount_for_the_pay_period>
      <bb:projectedBalanceTotal.effectiveDate1>07112012</bb:projectedBalanceTotal.effectiveDate1>
      <bb:projectedBalanceTotal.employeeid>123454</bb:projectedBalanceTotal.employeeid>
   </projectedBalanceTotal>
   <projectedBalanceTotal>
      <bb:projectedBalanceTotal.principalId>1238974569/bb:projectedBalanceTotal.principalId>
      <bb:projectedBalanceTotal.planCodeId>SS</bb:projectedBalanceTotal.planCodeId>
      <bb:projectedBalanceTotal.leaveCodeId>SS</bb:projectedBalanceTotal.leaveCodeId>
      <bb:projected_balance_accrual_amount_for_the_pay_period>3.323</bb:projected_balance_accrual_amount_for_the_pay_period>
      <bb:projectedBalanceTotal.effectiveDate1>07252012</bb:projectedBalanceTotal.effectiveDate1>
      <bb:projectedBalanceTotal.employeeid>123454</bb:projectedBalanceTotal.employeeid>
   </projectedBalanceTotal>
   <projectedBalanceTotal>
      <bb:projectedBalanceTotal.principalId>1238974569/bb:projectedBalanceTotal.principalId>
      <bb:projectedBalanceTotal.planCodeId>SS</bb:projectedBalanceTotal.planCodeId>
      <bb:projectedBalanceTotal.leaveCodeId>SS</bb:projectedBalanceTotal.leaveCodeId>
      <bb:projected_balance_accrual_amount_for_the_pay_period>3.323</bb:projected_balance_accrual_amount_for_the_pay_period>
      <bb:projectedBalanceTotal.effectiveDate1>08082012</bb:projectedBalanceTotal.effectiveDate1>
      <bb:projectedBalanceTotal.employeeid>123454</bb:projectedBalanceTotal.employeeid>
   </projectedBalanceTotal>
   <projectedBalanceTotal>
      <bb:projectedBalanceTotal.principalId>1238974569/bb:projectedBalanceTotal.principalId>
      <bb:projectedBalanceTotal.planCodeId>WR</bb:projectedBalanceTotal.planCodeId>
      <bb:projectedBalanceTotal.leaveCodeId>WR</bb:projectedBalanceTotal.leaveCodeId>
      <bb:projected_balance_accrual_amount_for_the_pay_period>0</bb:projected_balance_accrual_amount_for_the_pay_period>
      <bb:projectedBalanceTotal.effectiveDate1>07112012</bb:projectedBalanceTotal.effectiveDate1>
      <bb:projectedBalanceTotal.employeeid>123454</bb:projectedBalanceTotal.employeeid>
   </projectedBalanceTotal>
   <projectedBalanceTotal>
      <bb:projectedBalanceTotal.principalId>1238974569/bb:projectedBalanceTotal.principalId>
      <bb:projectedBalanceTotal.planCodeId>WR</bb:projectedBalanceTotal.planCodeId>
      <bb:projectedBalanceTotal.leaveCodeId>WR</bb:projectedBalanceTotal.leaveCodeId>
      <bb:projected_balance_accrual_amount_for_the_pay_period>0</bb:projected_balance_accrual_amount_for_the_pay_period>
      <bb:projectedBalanceTotal.effectiveDate1>07252012</bb:projectedBalanceTotal.effectiveDate1>
      <bb:projectedBalanceTotal.employeeid>123454</bb:projectedBalanceTotal.employeeid>
   </projectedBalanceTotal>
   <projectedBalanceTotal>
      <bb:projectedBalanceTotal.principalId>1238974569/bb:projectedBalanceTotal.principalId>
      <bb:projectedBalanceTotal.planCodeId>WR</bb:projectedBalanceTotal.planCodeId>
      <bb:projectedBalanceTotal.leaveCodeId>WR</bb:projectedBalanceTotal.leaveCodeId>
      <bb:projected_balance_accrual_amount_for_the_pay_period>0</bb:projected_balance_accrual_amount_for_the_pay_period>
      <bb:projectedBalanceTotal.effectiveDate1>08082012</bb:projectedBalanceTotal.effectiveDate1>
      <bb:projectedBalanceTotal.employeeid>123454</bb:projectedBalanceTotal.employeeid>
   </projectedBalanceTotal>
   <projectedBalanceTotal>
      <bb:projectedBalanceTotal.principalId>1238974569/bb:projectedBalanceTotal.principalId>
      <bb:projectedBalanceTotal.planCodeId>VA</bb:projectedBalanceTotal.planCodeId>
      <bb:projectedBalanceTotal.leaveCodeId>VA</bb:projectedBalanceTotal.leaveCodeId>
      <bb:projected_balance_accrual_amount_for_the_pay_period>0</bb:projected_balance_accrual_amount_for_the_pay_period>
      <bb:projectedBalanceTotal.effectiveDate1>07112012</bb:projectedBalanceTotal.effectiveDate1>
      <bb:projectedBalanceTotal.employeeid>123454</bb:projectedBalanceTotal.employeeid>
   </projectedBalanceTotal>
   <projectedBalanceTotal>
      <bb:projectedBalanceTotal.principalId>1238974569/bb:projectedBalanceTotal.principalId>
      <bb:projectedBalanceTotal.planCodeId>VA</bb:projectedBalanceTotal.planCodeId>
      <bb:projectedBalanceTotal.leaveCodeId>VA</bb:projectedBalanceTotal.leaveCodeId>
      <bb:projected_balance_accrual_amount_for_the_pay_period>0</bb:projected_balance_accrual_amount_for_the_pay_period>
      <bb:projectedBalanceTotal.effectiveDate1>07252012</bb:projectedBalanceTotal.effectiveDate1>
      <bb:projectedBalanceTotal.employeeid>123454</bb:projectedBalanceTotal.employeeid>
   </projectedBalanceTotal>
   <projectedBalanceTotal>
      <bb:projectedBalanceTotal.principalId>1238974569/bb:projectedBalanceTotal.principalId>
      <bb:projectedBalanceTotal.planCodeId>VA</bb:projectedBalanceTotal.planCodeId>
      <bb:projectedBalanceTotal.leaveCodeId>VA</bb:projectedBalanceTotal.leaveCodeId>
      <bb:projected_balance_accrual_amount_for_the_pay_period>0</bb:projected_balance_accrual_amount_for_the_pay_period>
      <bb:projectedBalanceTotal.effectiveDate1>08082012</bb:projectedBalanceTotal.effectiveDate1>
      <bb:projectedBalanceTotal.employeeid>123454</bb:projectedBalanceTotal.employeeid>
   </projectedBalanceTotal>


   <projectedBalanceTotal>
      <bb:projectedBalanceTotal.principalId>4545645878/bb:projectedBalanceTotal.principalId>
      <bb:projectedBalanceTotal.planCodeId>SS</bb:projectedBalanceTotal.planCodeId>
      <bb:projectedBalanceTotal.leaveCodeId>SS</bb:projectedBalanceTotal.leaveCodeId>
      <bb:projected_balance_accrual_amount_for_the_pay_period>3.692</bb:projected_balance_accrual_amount_for_the_pay_period>
      <bb:projectedBalanceTotal.effectiveDate1>07112012</bb:projectedBalanceTotal.effectiveDate1>
      <bb:projectedBalanceTotal.employeeid>445241</bb:projectedBalanceTotal.employeeid>
   </projectedBalanceTotal>
   <projectedBalanceTotal>
      <bb:projectedBalanceTotal.principalId>4545645878/bb:projectedBalanceTotal.principalId>
      <bb:projectedBalanceTotal.planCodeId>SS</bb:projectedBalanceTotal.planCodeId>
      <bb:projectedBalanceTotal.leaveCodeId>SS</bb:projectedBalanceTotal.leaveCodeId>
      <bb:projected_balance_accrual_amount_for_the_pay_period>3.692</bb:projected_balance_accrual_amount_for_the_pay_period>
      <bb:projectedBalanceTotal.effectiveDate1>07252012</bb:projectedBalanceTotal.effectiveDate1>
      <bb:projectedBalanceTotal.employeeid>445241</bb:projectedBalanceTotal.employeeid>
   </projectedBalanceTotal>
   <projectedBalanceTotal>
      <bb:projectedBalanceTotal.principalId>4545645878/bb:projectedBalanceTotal.principalId>
      <bb:projectedBalanceTotal.planCodeId>SS</bb:projectedBalanceTotal.planCodeId>
      <bb:projectedBalanceTotal.leaveCodeId>SS</bb:projectedBalanceTotal.leaveCodeId>
      <bb:projected_balance_accrual_amount_for_the_pay_period>3.692</bb:projected_balance_accrual_amount_for_the_pay_period>
      <bb:projectedBalanceTotal.effectiveDate1>08082012</bb:projectedBalanceTotal.effectiveDate1>
      <bb:projectedBalanceTotal.employeeid>445241</bb:projectedBalanceTotal.employeeid>
   </projectedBalanceTotal>
   <projectedBalanceTotal>
      <bb:projectedBalanceTotal.principalId>4545645878/bb:projectedBalanceTotal.principalId>
      <bb:projectedBalanceTotal.planCodeId>WR</bb:projectedBalanceTotal.planCodeId>
      <bb:projectedBalanceTotal.leaveCodeId>WR</bb:projectedBalanceTotal.leaveCodeId>
      <bb:projected_balance_accrual_amount_for_the_pay_period>0</bb:projected_balance_accrual_amount_for_the_pay_period>
      <bb:projectedBalanceTotal.effectiveDate1>07112012</bb:projectedBalanceTotal.effectiveDate1>
      <bb:projectedBalanceTotal.employeeid>445241</bb:projectedBalanceTotal.employeeid>
   </projectedBalanceTotal>
   <projectedBalanceTotal>
      <bb:projectedBalanceTotal.principalId>4545645878/bb:projectedBalanceTotal.principalId>
      <bb:projectedBalanceTotal.planCodeId>WR</bb:projectedBalanceTotal.planCodeId>
      <bb:projectedBalanceTotal.leaveCodeId>WR</bb:projectedBalanceTotal.leaveCodeId>
      <bb:projected_balance_accrual_amount_for_the_pay_period>0</bb:projected_balance_accrual_amount_for_the_pay_period>
      <bb:projectedBalanceTotal.effectiveDate1>07252012</bb:projectedBalanceTotal.effectiveDate1>
      <bb:projectedBalanceTotal.employeeid>445241</bb:projectedBalanceTotal.employeeid>
   </projectedBalanceTotal>
   <projectedBalanceTotal>
      <bb:projectedBalanceTotal.principalId>4545645878/bb:projectedBalanceTotal.principalId>
      <bb:projectedBalanceTotal.planCodeId>WR</bb:projectedBalanceTotal.planCodeId>
      <bb:projectedBalanceTotal.leaveCodeId>WR</bb:projectedBalanceTotal.leaveCodeId>
      <bb:projected_balance_accrual_amount_for_the_pay_period>0</bb:projected_balance_accrual_amount_for_the_pay_period>
      <bb:projectedBalanceTotal.effectiveDate1>08082012</bb:projectedBalanceTotal.effectiveDate1>
      <bb:projectedBalanceTotal.employeeid>445241</bb:projectedBalanceTotal.employeeid>
   </projectedBalanceTotal>
   <projectedBalanceTotal>
      <bb:projectedBalanceTotal.principalId>4545645878/bb:projectedBalanceTotal.principalId>
      <bb:projectedBalanceTotal.planCodeId>VA</bb:projectedBalanceTotal.planCodeId>
      <bb:projectedBalanceTotal.leaveCodeId>VA</bb:projectedBalanceTotal.leaveCodeId>
      <bb:projected_balance_accrual_amount_for_the_pay_period>0</bb:projected_balance_accrual_amount_for_the_pay_period>
      <bb:projectedBalanceTotal.effectiveDate1>07112012</bb:projectedBalanceTotal.effectiveDate1>
      <bb:projectedBalanceTotal.employeeid>445241</bb:projectedBalanceTotal.employeeid>
   </projectedBalanceTotal>
   <projectedBalanceTotal>
      <bb:projectedBalanceTotal.principalId>4545645878/bb:projectedBalanceTotal.principalId>
      <bb:projectedBalanceTotal.planCodeId>VA</bb:projectedBalanceTotal.planCodeId>
      <bb:projectedBalanceTotal.leaveCodeId>VA</bb:projectedBalanceTotal.leaveCodeId>
      <bb:projected_balance_accrual_amount_for_the_pay_period>0</bb:projected_balance_accrual_amount_for_the_pay_period>
      <bb:projectedBalanceTotal.effectiveDate1>07252012</bb:projectedBalanceTotal.effectiveDate1>
      <bb:projectedBalanceTotal.employeeid>445241</bb:projectedBalanceTotal.employeeid>
   </projectedBalanceTotal>
   <projectedBalanceTotal>
      <bb:projectedBalanceTotal.principalId>4545645878/bb:projectedBalanceTotal.principalId>
      <bb:projectedBalanceTotal.planCodeId>VA</bb:projectedBalanceTotal.planCodeId>
      <bb:projectedBalanceTotal.leaveCodeId>VA</bb:projectedBalanceTotal.leaveCodeId>
      <bb:projected_balance_accrual_amount_for_the_pay_period>0</bb:projected_balance_accrual_amount_for_the_pay_period>
      <bb:projectedBalanceTotal.effectiveDate1>08082012</bb:projectedBalanceTotal.effectiveDate1>
      <bb:projectedBalanceTotal.employeeid>445241</bb:projectedBalanceTotal.employeeid>
   </projectedBalanceTotal>
</bb:Report_Data>

注意すべき点がいくつかあります...形式の変更に加えて、要素タグ「All_Eligible_Time_Off_Plans_for_Worker」を完全に削除し、「bb:Report_Entry」を「projectedBalanceTotal」に置き換えています。

「All_Eligible_Time_Off_Plans_for_Worker」を正常に削除し、「bb:Report_Entry」を「projectedBalanceTotal」に置き換えるXSLコードを記述していることを除いて、実質的に開始点はありません。それはここで見つけることができます:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns:wd="urn:com.workday.report/CR-INT486-Kuali_Trojan_Time-Absence_Balances__Hospital_Bi-Weekly_-Outbound" 
    exclude-result-prefixes="wd">
    <xsl:output indent="yes"/>
    <xsl:strip-space elements="*"/>

    <xsl:template match="comment()|processing-instruction()|@*">
        <xsl:copy>
            <xsl:apply-templates select="node()|@*"/>
        </xsl:copy>
    </xsl:template>

    <xsl:template match="*">
        <xsl:element name="{local-name()}">
            <xsl:apply-templates select="node()|@*"/>
        </xsl:element>
    </xsl:template>

    <xsl:template match="wd:All_Eligible_Time_Off_Plans_for_Worker">
        <xsl:apply-templates/>
    </xsl:template>

    <xsl:template match="wd:Report_Data">
        <xsl:copy>
            <xsl:apply-templates select="node()|@*"/>
        </xsl:copy>
    </xsl:template>

    <xsl:template match="wd:Report_Entry">
        <projectedleaveBalanceTotal>
            <xsl:apply-templates select="node()|@*"/>
        </projectedleaveBalanceTotal>
    </xsl:template>

</xsl:stylesheet>

どんな助けでも素晴らしいでしょう!よろしくお願いします。

4

1 に答える 1

2

これを試して ...

<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:bb="urn:com.workday.report/Projected_Balances_Outbound">
<xsl:output method="xml" indent="yes"/>

<xsl:template match="/">
 <bb:Report_Data>
   <xsl:apply-templates select="*/*/*/*[starts-with(local-name(),'projectedBalanceTotal.effectiveDate')]"/>
 </bb:Report_Data>
</xsl:template>

<xsl:template match="*">
<!-- Add predicate [starts-with(local-name(),'projectedBalanceTotal.effectiveDate')]
     to the match pattern if you feel like it. -->
   <projectedBalanceTotal>
     <xsl:copy-of select="
       ../../bb:projectedBalanceTotal.principalId  |
       ../bb:projectedBalanceTotal.planCodeId      |
       ../bb:projectedBalanceTotal.leaveCodeId     |
       ../bb:projected_balance_accrual_amount_for_the_pay_period |
       .                                           |
       ../../bb:projectedBalanceTotal.employeeid"   />
   </projectedBalanceTotal>
</xsl:template>

</xsl:stylesheet>

警告

これは <bb:projectedBalanceTotal.effectiveDate\d> ノードを出力します。ここで、「\d」は整数を意味します。サンプル入力には effectiveDate1、effectiveDate2 などがありますが、予想される出力には effectiveDate1 しかありません。これは単に事務的なエラーである可能性が高いため、すべての effectiveDate\d ノードの名前を effectiveDate1 に変更することはしませんでした。したがって、すべての effectiveDate\d ノードを正確に effectiveDate1 と呼ぶ必要がある場合は、それに応じて調整してください。

学習メモ

将来同様の問題を自己解決したい場合は、次の手法を試してください。

  1. 名前空間が解決すべき問題の本質的な部分でない限り、すべての名前空間を削除します。
  2. すべての長いノード名を (バナナ、リンゴ、ナシ) のような覚えやすい短い名前に置き換えます。
  3. 問題の真の核心までノードを単純化して排除します。バナナとリンゴの 2 つのノード タイプが同じルールで処理されている場合は、サンプル データでバナナを操作してください。
  4. 変換のルールの複雑さに比例して多くのユース ケースを生成し、ユース ケースがエッジ条件をカバーし、広範囲になるようにします。
  5. XSLT は、他のプログラミング言語と同じように扱ってください。Java でプログラムを書かなければならないのに、Java の知識がまったくない状態で始めたとしたら、本を買ったり、トレーニング コースに参加したりしますよね? 他の言語と同じように、SO の例を見ただけでは学習できません。

アップデート

OP は、有効な日付要素がローカル名に数値が埋め込まれていない出力になるように、スタイルシートの変更を要求しました。というわけで変更点は…

  1. 大きな xsl:copy-of を 3 つの部分に分割します。ドット (.) の前に 1 つ、ドット (.) に 1 つ、ドットの後に 1 つ (つまり、employeeid)。そのため、前のビットは次のようになります...

     <xsl:copy-of select="
       ../../bb:projectedBalanceTotal.principalId  |
       ../bb:projectedBalanceTotal.planCodeId      |
       ../bb:projectedBalanceTotal.leaveCodeId     |
       ../bb:projected_balance_accrual_amount_for_the_pay_period" />
    
  2. 真ん中のビット (本質的には xsl:copy-of select=".") については、名前を変更したいので copy-of を使用できません。したがって、リテラル要素を次のように置き換えます...

     <bb:projectedBalanceTotal.effectiveDate>
      <xsl:value-of select="." />
     </bb:projectedBalanceTotal.effectiveDate>
    
  3. 3 番目と最後のビットは最初のビットと似ていますが、employeeid 要素用です。

全体として、テンプレートを取得します...

<xsl:template match="*">
   <projectedBalanceTotal>
     <xsl:copy-of select="
       ../../bb:projectedBalanceTotal.principalId  |
       ../bb:projectedBalanceTotal.planCodeId      |
       ../bb:projectedBalanceTotal.leaveCodeId     |
       ../bb:projected_balance_accrual_amount_for_the_pay_period" />
     <bb:projectedBalanceTotal.effectiveDate>
      <xsl:value-of select="." />
     </bb:projectedBalanceTotal.effectiveDate>
     <xsl:copy-of select="../../bb:projectedBalanceTotal.employeeid" />
   </projectedBalanceTotal>
</xsl:template>
于 2012-07-25T04:19:02.887 に答える