• 0

XSLT value-of Not Working


Question

Hi guys,

I am currently developing a webservice that presents XML data to whatever user-agent is accessing it, but if the user-agent is a browser it will apply an XSLT transformation to output it as XHTML. I am finding that my

<xsl:value-of select="<node>" />

is returning nothing. Here is a preview:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="http://ssdintranet/ca/stopstart/stopstart2/xml-transform.asp"?>
<request xmlns="http://www.ssddrives.com/stopstart/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ssddrives.com/stopstart http://ssdintranet/ca/stopstart/stopstart2/resources/xml-request.xsd" valid="true">
	<ident>393</ident>
	<date-submitted>2006-07-09</date-submitted>
	<stop-note><![CDATA[]]></stop-note>
	<user dept="test" name="Matthew Abbott"></user>
	<auth username="" name="">
		<date-authed></date-authed>
	</auth>
	<fault-code>AS</fault-code>
	<process-code>CAD</process-code>
	<level>major</level>
	<stages>
		<stage name="UK Shipments" stop="True"></stage>
		<stage name="UK Materials" stop="True"></stage>
		<stage name="UK PCBs" stop="False"></stage>
		<stage name="UK Modules" stop="False"></stage>
		<stage name="US Shipments" stop="True"></stage>
		<stage name="US Materials" stop="True"></stage>
		<stage name="US PCBs" stop="False"></stage>
		<stage name="US Modules" stop="False"></stage>
	</stages>
	<customer-stop-info><![CDATA[]]></customer-stop-info>
	<next-action><![CDATA[]]></next-action>
	<status>negotiating</status>
	<references>
		<product>508</product>
		<product>507</product>
		<product>506</product>
		<part>AG112521U001</part>
		<part>AG112521T001</part>
		<part>AG112521A001</part>
		<ref type="QUALITY" value="4194"></ref>
	</references>
	<starts></starts>
</request>

And the simply XSLT:

<?xml version="1.0"?>
<xsl:transform version="2.0" xsl:version="2.0" xmlns:xsl="http://www.w3.org/1999/XML/Transform">
<xsl:output method="html" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" indent="yes"/>
	<xsl:template match="/">
		<xsl:apply-templates />
	</xsl:template>

	<xsl:template match="request">
		<!--#include file="header.asp"-->
		<p class="xsl-subtitle"><span class="a-link" style="float: right;"><a href="#" onclick="java script:location.reload();">Refresh</a></span>Viewing Request: <xsl:value-of select="/request/ident" /></p>
		<!--#include file="footer.asp"-->
	</xsl:template>
</xsl:transform>

What am I doing wrong?

Also, has anyone else noticed that if you are working with IE (at the office, its kinda forced), when an error occurs in an XML document, IE displays the lovely "XML page cannot be displayed", so you then fix the error and refresh the page, and the same "XML page cannot be displayed" is shown. Only when you close the browser and start it up again do you get your intended XML page. It's very frustrating!

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Well, just to let you all know if your doing XSLT in future, it doesn't extract XML data if you apply the incorrect namespaces... kinda makes sense really, silly me. At least it works now! And so ends my 1-person thread!

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.