HOi iedereen,
heb dit:
en als laatste:
Maar ik krijg dit als fout:
Stylesheet must start either with an 'xsl:stylesheet' or an
'xsl:transform' element, or with a literal result element that has an
'xsl:version' attribute, where prefix 'xsl' denotes the
'http://www.w3.org/1999/XSL/Transform' namespace.
THX
heb dit:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<Form ID="1" Formtitle="Title">
<Fields>
<Fieldset Legend="LegendText" >
<Field FieldName="Field1" Label="Title" Type="Text" Required="1" />
<Field FieldName="Field2" Label="Radio" Type="Radio" Required="0">
<Option Value="1" Text="Just One"/>
<Option Value="2" Text="Maybe Two"/>
</Field>
</Fieldset>
</Fields>
</Form>
Code:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="utf-8"/>
<xsl:template match="/Form">
<html>
<body>
<h1>
<xsl:value-of select="@Formtitle"/>
</h1>
<form id="1" action="myurl.com">
<fieldset>
<legend>
<xsl:value-of select="Fields/Fieldset/@Legend"/>
</legend>
<label>Title</label>
<xsl:for-each select="Fields/Fieldset/Field">
<xsl:if test="@Type = 'Text'">
<xsl:if test="@Required='1'">
<input type="text" name="{@FieldName}" class="jqueryValidate"/>
</xsl:if>
<xsl:if test="@Required='0'">
<input type="text" name="{@FieldName}"/>
</xsl:if>
</xsl:if>
<xsl:if test="@Type = 'Radio'">
<xsl:if test="@Required='1'">
<label>
<xsl:value-of select="@Label"/>
</label>
<input type="radio" name="{FieldName}" class="jqueryValidate"/>
</xsl:if>
<xsl:if test="@Required='0'">
<label>
<xsl:value-of select="@Label"/>
</label>
<xsl:for-each select="Option">
<input type="radio" name="Field2" Value="1"/> hallo
</xsl:for-each>
</xsl:if>
</xsl:if>
</xsl:for-each>
</fieldset>
</form>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
en als laatste:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Xsl;
namespace FormInputApp
{
public class Program
{
static void Main(string[] args)
{
// Load the style sheet.
XslCompiledTransform xslt = new XslCompiledTransform();
try
{
xslt.Load(@"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Xml\Schemas\xml.xsd");
}
catch (Exception er)
{
Console.Write(er.Message);
}
// Execute the transform and output the results to a file.
try
{
xslt.Transform(@"C:\Users\Niels Engelen\Desktop\generate\FormInputApp\input.xml", @"C:\hallo\result.html");
}
catch (Exception exep)
{
Console.Write(exep.Message);
}
Console.WriteLine("Result saved to C:\result.html");
Console.ReadLine();
}
}
}
Maar ik krijg dit als fout:
Stylesheet must start either with an 'xsl:stylesheet' or an
'xsl:transform' element, or with a literal result element that has an
'xsl:version' attribute, where prefix 'xsl' denotes the
'http://www.w3.org/1999/XSL/Transform' namespace.
THX