WordML (XSLT 2.0 を使用) を使用して MS Word に出力としてリストするタイムカードのリストがあり、(可能な場合) 完了方法がわからない何らかのグループ化を行う必要があると考えています。
上層部が探しているのは、各日付 (日付でソート) ごとで、すべての情報がタイムキーパーごとに 1 つのセクションにまとめられています。(日付、タイムキーパーのイニシャル、その日付の合計時間、その日付のそのタイムキーパーのすべてのナラティブ データのリスト)。
これが私が現在持っているものです。これは、日付ごとの各タイムキーパー/タイムカードによるもので、グループ化は行われていません。
入力:
<xml-sample>
<timecard index="10">
<timekeeper>
<initials>NC1</initials>
</timekeeper>
<date type="timecard">2015-09-01</date>
<card-values>
<card-value type="billed">
<rate>325.00</rate>
<hours>0.20</hours>
<amount>65.0000</amount>
</card-value>
</card-values>
<narrative>
<line id="1">Narrative for 9/1/2015. With some more detail</line>
<line id="2">on the 2nd line ID.</line>
</narrative>
</timecard>
<timecard index="11">
<timekeeper>
<initials>NC1</initials>
</timekeeper>
<date type="timecard">2015-09-01</date>
<card-values>
<card-value type="billed">
<rate>325.00</rate>
<hours>0.40</hours>
<amount>130.0000</amount>
</card-value>
</card-values>
<narrative>
<line id="1">Another narrative for 9/1/2015. With some more</line>
<line id="2">detail on the 2nd line ID.</line>
</narrative>
</timecard>
<timecard index="12">
<timekeeper>
<initials>NC1</initials>
</timekeeper>
<date type="timecard">2015-09-12</date>
<card-values>
<card-value type="billed">
<rate>325.00</rate>
<hours>0.30</hours>
<amount>97.5000</amount>
</card-value>
</card-values>
<narrative>
<line id="1">Narrative for 9/12/2015. With some more detail</line>
<line id="2">detail on the 2nd line ID.</line>
</narrative>
</timecard>
現在のコード:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:aml="http://schemas.microsoft.com/aml/2001/core"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:kmf="http://www.kleinmundo.com/functions"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:sl="http://schemas.microsoft.com/schemaLibrary/2003/core"
xmlns:tlr="http://www.elite.com/functions"
xmlns:st1="urn:schemas-microsoft-com:office:smarttags"
xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml"
xmlns:w10="urn:schemas-microsoft-com:office:word"
xmlns:wsp="http://schemas.microsoft.com/office/word/2003/wordml/sp2"
xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:template name="Time_Detail_Sample">
<xsl:for-each select="xsm-sample/timecard">
<w:p>
<w:r>
<w:t>Date: <xsl:value-of select="format-date(date, '[M01]/[D01]/[Y01]')" />
</w:t>
</w:r>
</w:p>
<w:p>
<w:r>
<w:t>Timekeeper: <xsl:value-of select="timekeeper/initials" />
</w:t>
</w:r>
</w:p>
<w:p>
<w:r>
<w:t>Hours: <xsl:value-of select="format-number(card-values/card-value[@type='billed']/hours, '###,##0.00')" />
</w:t>
</w:r>
</w:p>
<w:p>
<w:r>
<xsl:for-each select="narrative/line">
<w:t>
<xsl:value-of select="(.)" />
<xsl:value-of select="' '" />
</w:t>
</xsl:for-each>
</w:r>
</w:p>
<w:p />
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
現在の出力:
望ましい出力: (ご覧のとおり、2015 年 9 月 1 日のデータは時間の合計にまとめられ、すべてのナラティブの詳細がまとめて一覧表示されます)。