gpt4 book ai didi

xml - 我们必须为模板标签中的匹配赋予什么值?

转载 作者:行者123 更新时间:2023-12-03 16:46:00 25 4
gpt4 key购买 nike

Source xml file:


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Inbound Message -->
<Sales xmlns="abc:org.xcbl:schemas/xcbl/v4/xcbl4.xsd" xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding">
</Sales>

Code:


 <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

<xsl:template match="/Sales">
</xsl:template>

Query: In the source xml, Sales root node tag contains the below values. xmlns="abc:org.xcbl:schemas/xcbl/v4/xcbl4.xsd" xmlns:SOAPENV="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding

How to start the template?


<xsl:template match="/Sales'> 
<xsl:template match="/'>

Above code is not working. Please help me to resolve this issue



.

最佳答案

在 XSLT 中声明命名空间,然后使用限定名,例如:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ns="abc:org.xcbl:schemas/xcbl/v4/xcbl4.xsd">

<xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes"/>

<xsl:template match="/ns:Sales">
</xsl:template>

</xsl:stylesheet>

关于xml - 我们必须为模板标签中的匹配赋予什么值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7722589/

25 4 0