posted 17 years ago
I have some xml that I need to transform to an xml output. However, when the xslt does a xpath lookup on the xml, it cannot find the xml element. This is because it cannot find the namespace.
How do I get this to work if I cannot change the xml, but I can modify the xslt?
<getClientRequest xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://resources.vero.co.nz/schemas/ClientEnabler">
<versionId>2.0</versionId>
<client>
<clientId>
<value>7246272</value>
</clientId>
</client>
</getClientRequest>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:solvit="http://resources.vero.co.nz/schemas/ClientEnabler"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fn="http://www.w3.org/2004/10/xpath-functions"
xmlns:xdt="http://www.w3.org/2004/10/xpath-datatypes"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
exclude-result-prefixes="xsl xsi xdt fn xs #default">
<xsl:template match="*"/>
<xsl:template match="solvit:getClientRequest">
<xsl:element name="SOLVIT">
<xsl:element name="XMLHead">
<xsl:element name="Service">ENQUIRECLIENT</xsl:element>
</xsl:element>
<xsl:element name="XMLData">
<xsl:element name="Client">
<xsl:element name="CLTKY"><xsl:value-of select="client/clientId/value"/></xsl:element>
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
[ March 05, 2006: Message edited by: Blikkies Marais ]