XSLT Brain Death has occured

  • Thread starter One Handed Man \( OHM - Terry Burns \)
  • Start date
O

One Handed Man \( OHM - Terry Burns \)

I've been battling with this stupid problem for hours now.

WebApp:

Trying to do a simple transformation using XSLT to a Web Page, but it just
failes without an error message ( In other words, it bums out with a general
exeption with no message ).

It creates the Ouput.html, but errors and does not fill it with HTML.

Where am I going wrong ?

Cheers - OHM

//**********************************
//CODE
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim xreader As New XmlTextReader(Server.MapPath("XDATA.XML"))
Dim xDoc As XPathDocument = New XPathDocument(xreader)
Dim oXSLT As XslTransform = New XslTransform
Dim xWriter As XmlTextWriter = New
XmlTextWriter(Server.MapPath("Output.html"), Nothing)

Try
oXSLT.Load(Server.MapPath("XDATA.XSLT"))
oXSLT.Transform(xDoc, Nothing, xWriter)

Catch ex As XsltException
Response.Write("<B>FAILED - XSLT Exception </B" & ex.Message)
Catch ex As XsltCompileException
Response.Write("<B>FAILED: XLST Compilation Exception</B" &
ex.Message)
Catch ex As Exception
Response.Write("<B>FAILED: Unkown Exception - </B" & ex.Message)

Finally

xreader.Close()
xWriter.Close()
End Try
End Sub


//**************************************
// XML
<?xml version="1.0" encoding="utf-8" ?>
<bookstore xmlns="x-schmema:XDATA.xsd">

<book title="Wind In the Willows" author="Author Winkle"/>
<book title="Wind In the Bows" author="Martha Winkle"/>
<book title="Gale In the Willows" author="Susan Winkle"/>

</bookstore>

//****************************************
// XSD
<?xml version="1.0"?>
<xs:schema id="bookstore" targetNamespace="x-schmema:XDATA.xsd"
xmlns:mstns="x-schmema:XDATA.xsd" xmlns="x-schmema:XDATA.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:element name="bookstore" msdata:IsDataSet="true" msdata:Locale="en-GB"
msdata:EnforceConstraints="False">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="book">
<xs:complexType>
<xs:attribute name="title" form="unqualified" type="xs:string"
/>
<xs:attribute name="author" form="unqualified" type="xs:string"
/>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>

//*********************************************
// TRANSFORM
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns=xsl:"http://www.w3.org/1999/XSL/Transform"
xmlns:blush:p="x-schemas:XDATA.xsd">
<xsl:template match="op:bookstore">
<HTML><BODY>
<TABLE>
<TR>
<TD><B>Title</B></TD>
<TD><B>Author</B></TD>
</TR>
<xsl:apply-templates select="op:book"/>
</TABLE>
</BODY></HTML>
</xsl:template>
<xsl:template match="op:book">
<TR>
<TR>
<TD><xsl:value-of select="op:title"/></TD>
</TR>
</TR>
</xsl:template>
</xsl:stylesheet>

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing
 
O

One Handed Man \( OHM - Terry Burns \)

Dont worry guys, I'm making headway with this, not there yet but getting
close.


Cheers

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing
 
O

One Handed Man \( OHM - Terry Burns \)

If anyone is interested, normal brain functions resumed this AM and problems
were fixed.

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing
 
T

The Grim Reaper

That was quick. One mention of XML or XSLT and my brain stays dead for a
week :p
____________________
Grim
 
O

One Handed Man \( OHM - Terry Burns \)

I must admit, I have found transformations a bit of a challenge

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing
 
O

One Handed Man \( OHM - Terry Burns \)

Does that mean you are looking at them as well ?

BTW, what does :S mean ?

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing
 
T

The Grim Reaper

No, it doesn't - sorry!! I'm busy trying to get data from a 64 pin I/O card
and cross-linked PLC :)

:S is an MSN Messenger smiley - it's a confused look. Wiggly mouth sort of
thing.
_____________________________
Grim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top