親ノードの個別の子要素を反復しようとしました。予想されるxmlをフレームする 以下は私のXMLです。動的に親要素を取得し、xsltでxmlの動的子要素を処理します。
<NewDataSet>
<caseParticipants>
<Litigants>PORTFOLIO RECOVERY ASSOCIATES</Litigants>
<Attorneys>MANISCALCO, ANTHONY JOSEPH</Attorneys>
</caseParticipants>
<caseParticipants>
<Litigants>PLAINTIFF</Litigants>
<Attorneys>Plaintiff Attorney</Attorneys>
</caseParticipants>
<caseParticipants>
<Litigants />
<Attorneys />
<caseProceedings>
<Date>05/12/2015</Date>
<Details>PETITION/COMPLAINT NO DOC#</Details>
</caseProceedings>
<caseProceedings>
<Date>05/12/2015</Date>
<Details>ASM: SMALL CLAIMS $501-$2,500</Details>
</caseProceedings>
<caseCalendar>
<Date>06/30/2015 13:00:00</Date>
<Docket_x0020_Type>PRETRIAL CONF</Docket_x0020_Type>
<Judge>LANDT, ROBERT E</Judge>
<Location>XX : COURTR</Location>
</caseCalendar>
<caseFinancialSummary>
<Column1>Assessment Total:</Column1>
<Column2>$185.00</Column2>
</caseFinancialSummary>
<caseFinancialSummary>
<Column1>Assessment Paid:</Column1>
<Column2>$185.00</Column2>
</caseFinancialSummary>
<caseFinancialSummary>
<Column1>Assessment Due:</Column1>
<Column2>$0.00</Column2>
</caseFinancialSummary>
<caseFinancialSummary>
<Column1>Restitution Total:</Column1>
<Column2>$0.00</Column2>
</caseFinancialSummary>
<caseFinancialSummary>
<Column1>Restitution Paid:</Column1>
<Column2>$0.00</Column2>
</caseFinancialSummary>
<caseFinancialSummary>
<Column1>Restitution Due:</Column1>
<Column2>$0.00</Column2>
</caseFinancialSummary>
<caseFinancialSummary />
<caseFinancialdetails>
<Assessment_x0020_Due>$185.00</Assessment_x0020_Due>
<Assessment_x0020_Paid>$185.00</Assessment_x0020_Paid>
<Restitution_x0020_Due>$0.00</Restitution_x0020_Due>
<Restitution_x0020_Paid>$0.00</Restitution_x0020_Paid>
</caseFinancialdetails>
</NewDataSet>
以下のようにxmlにトランスポーズする必要があります。
<searchResult>
<caseDetails>
<caseParticipants Label="Participants">
<row>
<colhead id="1" align="left" bold="no">Litigants</colhead>
<colhead id="2" align="left" bold="no">Attorneys</colhead>
</row>
<row>
<cell id="1">Portfolio Recovery Associates</cell>
<cell id="2">Maniscalco, Anthony Joseph</cell>
</row>
<row>
<cell id="1">Plaintiff</cell>
<cell id="2">Plaintiff Attorney</cell>
</row>
<row>
<cell id="1" />
<cell id="2" />
</row>
</caseParticipants>
<caseProceedings Label="Proceedings">
<row>
<colhead id="1" align="left" bold="no">Date</colhead>
<colhead id="2" align="left" bold="no">Details</colhead>
</row>
<row>
<cell id="1">05/12/2015</cell>
<cell id="2">Petition/Complaint no Doc#</cell>
<document available="No" />
</row>
<row>
<cell id="1">05/12/2015</cell>
<cell id="2">Asm: Small Claims $501-$2,500</cell>
<document available="No" />
</row>
</caseProceedings>
<caseCalendar Label="Calendar">
<row>
<colhead id="1" align="left" bold="no">Date</colhead>
<colhead id="2" align="left" bold="no">Docket Type</colhead>
<colhead id="3" align="left" bold="no">Judge</colhead>
<colhead id="4" align="left" bold="no">Location</colhead>
<colhead id="5" align="left" bold="no">Prosecutor</colhead>
<colhead id="6" align="left" bold="no">Defendant Attorney</colhead>
</row>
<row>
<cell id="1">06/30/2015 13:00:00</cell>
<cell id="2">Pretrial Conf</cell>
<cell id="3">Landt, Robert E</cell>
<cell id="4">Xx : Courtr</cell>
<cell id="5" />
<cell id="6" />
</row>
</caseCalendar>
<caseFinancialSummary Label="Financial Summary">
<row>
<colhead id="1" align="right" bold="no" />
<colhead id="2" align="left" bold="no" />
</row>
<row>
<cell id="1">Assessment Total:</cell>
<cell id="2">$185.00</cell>
</row>
<row>
<cell id="1">Assessment Paid:</cell>
<cell id="2">$185.00</cell>
</row>
<row>
<cell id="1">Assessment Due:</cell>
<cell id="2">$0.00</cell>
</row>
<row>
<cell id="1">Restitution Total:</cell>
<cell id="2">$0.00</cell>
</row>
<row>
<cell id="1">Restitution Paid:</cell>
<cell id="2">$0.00</cell>
</row>
<row>
<cell id="1">Restitution Due:</cell>
<cell id="2">$0.00</cell>
</row>
</caseFinancialSummary>
<caseFinancialDetails Label="Financial Details">
<row>
<colhead id="1" align="left" bold="no">Assessment Due</colhead>
<colhead id="2" align="left" bold="no">Assessment Paid</colhead>
<colhead id="3" align="left" bold="no">Restitution Due</colhead>
<colhead id="4" align="left" bold="no">Restitution Paid</colhead>
<colhead id="5" align="left" bold="no">Payment Date</colhead>
</row>
<row>
<cell id="1">$185.00</cell>
<cell id="2">$185.00</cell>
<cell id="3">$0.00</cell>
<cell id="4">$0.00</cell>
<cell id="5" />
</row>
</caseFinancialDetails>
</caseDetails>
私はcaseParticipantについては、以下のような唯一つのセクションを試してみました。私は要素名を与えずにすべてのノードでこれを行う必要があります。私は毎回親子の要素の異なる型を得るからです。
XSLTコード:
<xsl:template match="caseParticipants">
<xsl:variable name="vrtfEvalResult">
<xsl:call-template name="eval">
<xsl:with-param name="pPath" select="'/NewDataSet/caseParticipants'"/>
</xsl:call-template>
</xsl:variable>
<row>
<cell id="1"><xsl:value-of select="Litigants" /></cell>
<cell id="2"><xsl:value-of select="Attorney" /></cell>
</row>
</xsl:template>
<xsl:template match="text()"/>
<xsl:template match="Path" name="eval">
<xsl:param name="pPath" select="."/>
<xsl:param name="pContext" select="/"/>
<xsl:choose>
<!-- If there is something to evaluate -->
<xsl:when test="string-length($pPath) >0">
<xsl:variable name="vPath" select=
"substring($pPath,2)"/>
<xsl:variable name="vNameTest">
<xsl:choose>
<xsl:when test="not(contains($vPath, '/'))">
<xsl:value-of select="$vPath"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select=
"substring-before($vPath, '/')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="eval">
<xsl:with-param name="pPath" select=
"substring-after($pPath, $vNameTest)"/>
<xsl:with-param name="pContext" select=
"$pContext/*[name()=$vNameTest]"/>
</xsl:call-template>
</xsl:when>
<!-- Otherwise we have evaluated completely the path -->
<xsl:otherwise>
<xsl:copy-of select="$pContext"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
おかげで、事前
おかげで... – Prabha
問題ありません - 親指の私のルールは私がXSLTで「明確な」または「グループ」をいつでも、考えてみるということですそこに行くために 'キー 'を使う方法について –
確かに...ガイダンスのおかげで.. – Prabha