Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How come no data is being transformed ?

Status
Not open for further replies.

cpope

Programmer
Jul 7, 2000
58
US
I have an xml document...

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="transform.xsl"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV=" xmlns:soap=" xmlns:xsi=" xmlns:xsd=" <SOAP-ENV:Body>
<LoginResponse xmlns="urn:CICSMCSWSAD1">
<ACCOUNT>0123456789
</ACCOUNT>
<USERID>guest1
</USERID>
<PASSWORD>guest1pwd
</PASSWORD>
<PASSWORDHINT>pwd plus user id
</PASSWORDHINT>
<EMAIL>guest1@email.com
</EMAIL>
<REGISTRATIONKEY>deprecated
</REGISTRATIONKEY>
<LOGINSUCCESS>Y
</LOGINSUCCESS>
<PROCESSSUCCESS>Y
</PROCESSSUCCESS>
<LASTACCESS>12-24-2002
</LASTACCESS>
<CREATEDATE>11-11-2002
</CREATEDATE>
</LoginResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

my transformation is as follows:

<?xml version="1.0" encoding="utf-8"?>
<xsl:transform version="1.0" xmlns:xsl=" xmlns:SOAP-ENV=" <xsl:template match="/">
<html>
<head>
<title>Testing Transformation</title>
</head>
<body>
<table border="1">
<th>Account</th><th>Hint</th><th>Last Access</th><th>Reg. Date</th><th>User</th>
<xsl:for-each select="SOAP-ENV:Envelope/SOAP-ENV:Body/LoginResponse">
<tr><td><xsl:value-of select="ACCOUNT"/></td>
<td><xsl:value-of select="PASSWORDHINT"/></td>
<td><xsl:value-of select="LASTACCESS"/></td>
<td><xsl:value-of select="CREATEDATE"/></td>
<td><xsl:value-of select="USERID"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:transform>

The table shows up fine, but no data is loaded....
 
Problem solved by adding a prefix and assigning it to the urn value in the xml file... xmlns:CIC="urn:CICSMCSWSAD1", then using that prefix to select the LoginResponse and it's child nodes...

<?xml version="1.0" encoding="utf-8"?>
<xsl:transform version="1.0" xmlns:xsl=" xmlns:SOAP-ENV=" xmlns:CIC="urn:CICSMCSWSAD1">
<xsl:template match="/">
<html>
<head>
<title>Testing Transformation</title>
</head>
<body>
<table border="1">
<th>Account</th><th>Hint</th><th>Last Access</th><th>Reg. Date</th><th>User</th>
<xsl:for-each select="SOAP-ENV:Envelope/SOAP-ENV:Body/CIC:LoginResponse">
<tr><td><xsl:value-of select="CIC:ACCOUNT"/></td>
<td><xsl:value-of select="CIC:pASSWORDHINT"/></td>
<td><xsl:value-of select="CIC:LASTACCESS"/></td>
<td><xsl:value-of select="CIC:CREATEDATE"/></td>
<td><xsl:value-of select="CIC:USERID"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:transform>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top