こんにちは私はXSLとフィルタリングアレイに問題があります。
これは私のXSL変換です:
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:ns0="http://xmlns.sse.com/SSEPD/GIS/PublishChangeSetEBM" xmlns:tns="http://xmlns.sse.com/SSEPD/GIS/UpdateLocationEBM" xmlns:oraxsl="http://www.oracle.com/XSL/Transform/java" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype" xmlns:ns1="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ns3="http://iec.ch/2002/schema/CIM_difference_model#" xmlns:ns4="http://xmlns.sse.com/SSEPD/GIS/ChangeSetEBO" xmlns:ns5="http://iec.ch/TC57/2010/CIM-schema-cim15#" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns2="http://xmlns.sse.com/Enterprise/Common" xmlns:client="http://xmlns.oracle.com/GIS_R1_SOA/SubstationEBS/SubstationEBS" xmlns:ns7="http://www.ibm.com/maximo" xmlns:ns6="http://xmlns.oracle.com/GIS_R1_SOA/UpdateLocationProviderABCS/UpdateLocationProviderABCS" xmlns:ns8="http://xmlns.sse.com/SSEPD/GIS/UpdateLocationEBO">
<xsl:variable name="ID_HASH">#</xsl:variable>
<xsl:template match="/">
<tns:UpdateLocationEBM>
<tns:DataArea>
<ns7:SyncSSENLOCATIONS>
<ns7:SSENLOCATIONSSet>
<xsl:apply-templates select="/ns0:PublishChangeSetRequestEBM/ns0:DataArea/ns4:ChangeSet/ns1:RDF/ns3:DifferenceModel/ns3:forwardDifferences/ns5:Substation"/>
</ns7:SSENLOCATIONSSet>
</ns7:SyncSSENLOCATIONS>
</tns:DataArea>
</tns:UpdateLocationEBM>
</xsl:template>
<xsl:template match="/ns0:PublishChangeSetRequestEBM/ns0:DataArea/ns4:ChangeSet/ns1:RDF/ns3:DifferenceModel/ns3:forwardDifferences/ns5:Substation">
<ns7:LOCATIONS>
<xsl:variable name="CURRENT_SUB" select="."/>
<ns7:CURRENT_SUB>
<xsl:value-of select="$CURRENT_SUB"/>
</ns7:CURRENT_SUB>
<xsl:variable name="LOCATION" select="/ns0:PublishChangeSetRequestEBM/ns0:DataArea/ns4:ChangeSet/ns1:RDF/ns3:DifferenceModel/ns3:forwardDifferences/ns5:Location[@ns1:ID = substring-after($CURRENT_SUB/ns5:PowerSystemResource.Location/@ns1:resource, $ID_HASH)]"/>
<xsl:variable name="VOLTAGE_LEVEL" select="/ns0:PublishChangeSetRequestEBM/ns0:DataArea/ns4:ChangeSet/ns1:RDF/ns3:DifferenceModel/ns3:forwardDifferences/ns5:VoltageLevel[ns5:VoltageLevel.Substation/@ns1:resource = concat($ID_HASH,$CURRENT_SUB/@ns1:ID)]"/>
<ns7:VOLTAGE_LEVEL>
<xsl:value-of select="$VOLTAGE_LEVEL"/>
</ns7:VOLTAGE_LEVEL>
<ns7:LOCATION>
<xsl:value-of select="$LOCATION/ns5:Location.ngr"/>
</ns7:LOCATION>
</ns7:LOCATIONS>
</xsl:template>
</xsl:stylesheet>
これはXML入力です。
<PublishChangeSetRequestEBM xmlns:cim="http://iec.ch/TC57/2010/CIM-schema-cim15#" xmlns:ns5="http://iec.ch/TC57/2010/CIM-schema-cim15#" xmlns:dm="http://iec.ch/2002/schema/CIM_difference_model#" xmlns:ns3="http://iec.ch/2002/schema/CIM_difference_model#" xmlns:ebo="http://xmlns.sse.com/SSEPD/GIS/ChangeSetEBO" xmlns:tns="http://xmlns.sse.com/SSEPD/GIS/PublishChangeSetEBM" xmlns="http://xmlns.sse.com/SSEPD/GIS/PublishChangeSetEBM" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ns1="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ns4="http://xmlns.sse.com/SSEPD/GIS/ChangeSetEBO" xmlns:ns0="http://xmlns.sse.com/SSEPD/GIS/PublishChangeSetEBM">
<tns:DataArea>
<ebo:ChangeSet>
<ebo:JobID>100035</ebo:JobID>
<ebo:FileName>Substation_XREF.rdf</ebo:FileName>
<rdf:RDF>
<dm:DifferenceModel rdf:about="">
<dm:forwardDifferences rdf:parseType="Statements">
<cim:Substation rdf:ID="IL_SUB001">
<cim:PowerSystemResource.Location rdf:resource="#SUB_loc001"/>
</cim:Substation>
<cim:VoltageLevel rdf:ID="VOL_001">
<cim:VoltageLevel.Substation rdf:resource="#IL_SUB001"/>
</cim:VoltageLevel>
<cim:Location rdf:ID="SUB_loc001">
<cim:Location.ngr>SU33736744</cim:Location.ngr>
</cim:Location>
</dm:forwardDifferences>
</dm:DifferenceModel>
</rdf:RDF>
</ebo:ChangeSet>
</tns:DataArea>
</PublishChangeSetRequestEBM>
私が抱えている問題は、変数$ VOLTAGE_LEVELにあります。何らかの理由で、テンプレート関数内で変数を定義しているときに適用しているフィルタリング条件が機能していません。それを使用しているタグns7:VOLTAGE_LEVELは出力で空です。
さまざまなツールで再確認し、さまざまなテストを実行しましたが、問題は$ CURRENT_SUB変数にあるようです。しかし、タグns7:LOCATIONが正しい情報を表示しており、$ VOLTAGE_LEVELと同じアプローチを使用して入力された変数$ LOCATIONを使用しているため、これは奇妙です。
ご覧いただけますか?私は無知です。
注:私はスタイルシートバージョン2.0を使用しています
ニックよろしくお願いします
この変更されたテンプレートと述語値を次のように試すことができます。
<xsl:template match="/">
<tns:UpdateLocationEBM>
<tns:DataArea>
<ns7:SyncSSENLOCATIONS>
<ns7:SSENLOCATIONSSet>
<xsl:apply-templates
select="/ns0:PublishChangeSetRequestEBM/ns0:DataArea/ns4:ChangeSet/ns1:RDF/ns3:DifferenceModel/ns3:forwardDifferences/ns5:Substation" />
</ns7:SSENLOCATIONSSet>
</ns7:SyncSSENLOCATIONS>
</tns:DataArea>
</tns:UpdateLocationEBM>
</xsl:template>
<xsl:template
match="/ns0:PublishChangeSetRequestEBM/ns0:DataArea/ns4:ChangeSet/ns1:RDF/ns3:DifferenceModel/ns3:forwardDifferences/ns5:Substation">
<ns7:LOCATIONS>
<xsl:variable name="CURRENT_SUB" select="."/>
<ns7:CURRENT_SUB>
<xsl:value-of select="$CURRENT_SUB" />
</ns7:CURRENT_SUB>
<xsl:variable name="LOCATION"
select="/ns0:PublishChangeSetRequestEBM/ns0:DataArea/ns4:ChangeSet/ns1:RDF/ns3:DifferenceModel/ns3:forwardDifferences/ns5:Location[@ns1:ID = substring-after($CURRENT_SUB/ns5:PowerSystemResource.Location/@ns1:resource, $ID_HASH)]" />
<xsl:variable name="VOLTAGE_LEVEL"
select="/ns0:PublishChangeSetRequestEBM/ns0:DataArea/ns4:ChangeSet/ns1:RDF/ns3:DifferenceModel/ns3:forwardDifferences/ns5:VoltageLevel/ns5:VoltageLevel.Substation[@ns1:resource = concat($ID_HASH,$CURRENT_SUB/@ns1:ID)]" />
<ns7:VOLTAGE_LEVEL>
<xsl:value-of select="$VOLTAGE_LEVEL" />
</ns7:VOLTAGE_LEVEL>
<ns7:LOCATION>
<xsl:value-of select="$LOCATION/ns5:Location.ngr" />
</ns7:LOCATION>
</ns7:LOCATIONS>
</xsl:template>
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加