获取空值我试图获取xml元素但无法提取项目的值和来自
"<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://edd.att.com/cnmeddservice" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" exclude-result-prefixes="ns0 xs fn">
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<emailRequest xmlns="http://egs.att.com/EGSService">
<xsl:attribute name="project" namespace="" select="'MYWORLD'"/>
<xsl:attribute name="region" namespace="" select="'RNSALL'"/>
<xsl:attribute name="letterType" namespace="" select="'BBUDO100'"/>
<xsl:attribute name="customerType" namespace="" select="'C'"/>
<xsl:for-each select="ns0:bbuRequest">
<xsl:attribute name="language" namespace="" select="fn:string(@language)"/>
</xsl:for-each>
<retryIndicator>
<xsl:sequence select="'N'"/>
</retryIndicator>
<ban>
<xsl:sequence select="'9999999999'"/>
</ban>
<header>
<xsl:for-each select="ns0:bbuRequest/ns0:destinations/ns0:emailAddress1">
<to>
<xsl:sequence select="fn:string(.)"/>
</to>
</xsl:for-each>
<xsl:for-each select="ns0:bbuRequest/ns0:destinations/ns0:emailAddress2">
<to>
<xsl:sequence select="fn:string(.)"/>
</to>
</xsl:for-each>
<from>
<xsl:sequence select="'att'"/>
</from>
</header>
<body>
<templateData>
<xsl:for-each select="ns0:bbuRequest">
<dataField>
<xsl:attribute name="name">
<xsl:value-of select="'thresholddate'"/>
</xsl:attribute>
<xsl:choose>
<xsl:when test="string((string-length(string(ns0:thresholdDate)) > 10)) = 'true'">
<xsl:value-of select="substring(string(ns0:thresholdDate), 0, 11)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string(ns0:thresholdDate)"/>
</xsl:otherwise>
</xsl:choose>
</dataField>
</xsl:for-each>
</templateData>
</body>
</emailRequest>
</xsl:template>
</xsl:stylesheet>"
select EXTRACT(xmltype(column),
'//from') from table
where rownum <5
select XMLTYPE(xslt).EXTRACT('//emailRequest/@project','xmlns:xsl="http://www.w3.org/1999/XSL/Transform"').GETSTRINGVAL(),xslt from edd_egs_config
where rownum <2
尝试以上但没有运气
答案 0 :(得分:0)
您应该告诉Oracle两个使用过的命名空间:
SELECT utl_i18n.unescape_reference(XMLTYPE (xslt).EXTRACT ('//from/xsl:sequence/@select', 'xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://egs.att.com/EGSService"').GETSTRINGVAL (), xslt
FROM edd_egs_config
WHERE ROWNUM < 5
并更改第二个中的路径和名称空间:
SELECT utl_i18n.unescape_reference(XMLTYPE (xslt).EXTRACT ('//emailRequest/xsl:attribute[@name="project"]/@select', 'xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://egs.att.com/EGSService"').GETSTRINGVAL (), xslt
FROM edd_egs_config
WHERE ROWNUM < 2