Ok, weer een nieuw probleem in de xml/xsl reeks:
Ik heb de volgende bestanden:
xml-bestand
xsl-bestand
asp-bestand
Als ik dit asp-script uitvoer krijg ik de volgende foutmelding:
Invalid at the top level of the document.
Als ik dit xml-bestand clientside parse met de xsl-stylesheet werkt alles perfect
Kan iemand mij hiermee uit de brand helpen? En mij ook enige feedback geven aan de manier waarop ik mijn stylesheet in elkaar heb gezet? Is namelijk mijn eerste echte serieuze poging daartoe... tnx
Ik heb de volgende bestanden:
xml-bestand
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
| <?xml version="1.0" ?>
<xform:xform xmlns="http://www.hehenkamp.org"
xmlns:xform="http://www.hehenkamp.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hehenkamp.org
xforms.xsd">
<xform:submitInfo action="http://example.com/submit" method="..."/>
<xform:selectOne ref="as">
<xform:caption>Select Payment Method</xform:caption>
<xform:choices>
<xform:item value="cash"><xform:caption>Cash</xform:caption></xform:item>
<xform:item value="credit"><xform:caption>Credit</xform:caption></xform:item>
</xform:choices>
</xform:selectOne>
<xform:input ref="cc">
<xform:caption>Credit Card Number</xform:caption>
<xform:hint>Your Credit Card Number can be found on your Credit Card</xform:hint>
</xform:input>
<xform:input ref="exp">
<xform:caption>Expiration Date</xform:caption>
</xform:input>
<xform:submit>
<xform:caption>Submit</xform:caption>
</xform:submit>
</xform:xform> |
xsl-bestand
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
| <?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:xform="http://www.hehenkamp.org">
<xsl:output method="html"/>
<xsl:template match="/">
<html>
<head><title></title></head>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="xform:xform">
<form action="{xform:submitInfo/@action}" method="{xform:submitInfo/@method}">
<xsl:apply-templates/>
</form>
</xsl:template>
<xsl:template match="xform:selectOne">
<b><xsl:value-of select="xform:caption"/></b><br/>
<xsl:for-each select="xform:choices">
<xsl:apply-templates/>
</xsl:for-each>
</xsl:template>
<xsl:template match="xform:item">
<input type="radio" name="../../@ref" value="@value"/><xsl:value-of select="xform:caption"/><br/>
</xsl:template>
<xsl:template match="xform:input">
<input type="text" name="@ref" value=""/><xsl:value-of select="xform:caption"/><br/>
</xsl:template>
<xsl:template match="xform:submit">
<input type="submit" name="@ref" value="{xform:caption}"/>
</xsl:template>
</xsl:stylesheet> |
asp-bestand
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
| <%@ Language=VBScript %>
<%
if(Request.QueryString("clientSide") = "true") then
Response.ContentType = "text/xml"
Response.Write("")
end if
if(Request.QueryString("displayxml") = "true") then
Response.ContentType = "text/xml"
end if
function TransformData(szXML,szXSLFile)
dim oXML, oXSL
dim bResult
set oXML = Server.CreateObject("Microsoft.XMLDOM")
set oXSL = Server.CreateObject("Microsoft.XMLDOM")
'-- Load XML
bResult = not oXML.loadXML(Server.MapPath(szXML))
Response.Write oXML.parseError.reason
'-- Load XSL
oXSL.async = false
bResult = not oXSL.load(Server.MapPath(szXSLFile))
Response.Write oXSL.parseError.reason
TransformData = oXML.transformNode(oXSL)
set oXML = nothing
set oXSL = nothing
end function
Response.Write(TransformData("addCategoryForm.xml", "addCategoryForm5.xsl"))
%> |
Als ik dit asp-script uitvoer krijg ik de volgende foutmelding:
Invalid at the top level of the document.
Als ik dit xml-bestand clientside parse met de xsl-stylesheet werkt alles perfect
Kan iemand mij hiermee uit de brand helpen? En mij ook enige feedback geven aan de manier waarop ik mijn stylesheet in elkaar heb gezet? Is namelijk mijn eerste echte serieuze poging daartoe... tnx