0
試圖弄清爲什麼這不起作用。我遵循W3Schools XSLT Docs以及W3Schools XPath Docs上的說明,並且我一直對「MeterInfo」標籤的「MeterNo」值爲空。任何幫助將不勝感激。使用XSLT將Transfrom轉換爲XML
XSLT
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
exclude-result-prefixes="msxsl">
<xsl:template match="/">
<MeterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<MeterNo>
<xsl:value-of select="Template[@name='MyTemplateName']/Field[@name='MyFieldName']"/>
</MeterNo>
</MeterInfo>
</xsl:template>
XML
<?xml version="1.0" encoding="utf-8"?>
<ProcessHostRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.utilitysolutions.cgi.com/UHIB-1_0">
<DataArea>
<Process xmlns="http://www.openapplications.org/oagis" />
<HostRequest>
<Template name="MyTemplateName">
<Field name="MyFieldName">
8768565
</Field>
</Template>
</HostRequest>
</DataArea>
</ProcessHostRequest>
我的轉型響應
<?xml version="1.0" encoding="UTF-8"?>
<MeterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<MeterNo/>
</MeterInfo>
個