0

私はこのxmlファイルを持っています

<?xml version="1.0" encoding="UTF-8"?>
<bo:C837ClaimParent xsi:type="bo:C837ClaimParent"     
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   
xmlns:bo="http://somelongpathHere/process/bo">
<claimAux>
...
</claimAux>
<enterpriseClaim>
...
    <patientAccountNumber>data to capture here</patientAccountNumber>
</enterpriseClaim>

<bo:C837ClaimParent>内にある<enterpriseClaim>内にある<patientAccountNumber>内のデータを一致させる必要がありますxsl:templateの一致で考えられるすべての値を試しましたが、そのノードを一致させることができません。見つからないか、xmlファイル全体と一致する場合、xslファイルは次のようになります。

    <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" version="2.0" encoding="UTF-8" indent="yes"/>
    <xsl:template match="/">
    <html>
....
<div>
  <xsl:value-of select="C837ClaimParent/enterpriseClaim/patientAccountNumber" /></div>

xsl:templateとxsl:value-ofで何を指定する必要がありますか?

また、この同じファイルの場合、他の値と一致します。すべてがメインノード<bo:C837ClaimParent内にあるので、ファイル全体のノードを効率的に一致させるには、何を使用する必要がありますか?

4

2 に答える 2

2

boプレフィックスの名前空間宣言が欠落しているようです。この名前空間は、使用しない限り、おそらくソリューションに表示される必要がありますlocal-name()

編集(名前空間が表示された後!

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:bo="http://somelongpathHere/process/bo">
    <xsl:output method="xml" version="2.0" encoding="UTF-8" indent="yes"/>
    <xsl:template match="/">
    <html>
....
<div>
  <xsl:value-of select="bo:C837ClaimParent/enterpriseClaim/patientAccountNumber" /></div>

enterpriseClaimそれが別の名前空間にあることを確認しますC837ClaimParentか?

于 2009-10-26T22:39:47.593 に答える
1
<xsl:stylesheet ... xmlns:bo="http://www.bo.org">
   ...
   <xsl:value-of select="/bo:C837ClaimParent/enterpriseClaim/patientAccountNumber" />
   ...
</xsl:stylesheet>

一般的に、私のアドバイスは、XMLとXPathの名前空間について調べることです。

于 2009-10-26T22:43:52.233 に答える