1

I am currently working on a small side-project in MVC3. The goal is to make a personalized schedule (school). When users login, they should be able to review their schedule.

The XML with data is already delivered by an other programmer. A sample XML is found here http://hrooster.leonmastenbroek.nl/student-current.xml

I've managed to deserialize the XML to an object by creating a class with the "xsd.exe" tool. But honestly I don't know if that is useful :)

Now comes the question: How do you parse a XML file/object with a stylesheet (XSLT) into a Razor template? As you can see there are a lot of attributes in the timetable node so there are a lot of references. I made a stylesheet to arrange the data properly, but I don't have a clue how to combine it together.

Also it should be nested in a jQuery Mobile content div. And the XML is delivered by URL to me.

abatishchev
  • 98,240
  • 88
  • 296
  • 433
LeonM
  • 13
  • 3

1 Answers1

1

There are several different ways. If you the .NET Framework using Linq to XML to parse the XML into objects then XSLT is not really needed as you have already transformed the XML.

You can just transform the XML so that it created something like the following,

<description>@item.Description</description>

the @ is the prefix to the variable names.

If I was using XSLT I would be looking to create an HTML file of the data, I would then just output the HTML using Razor.

This may help,

How to apply an XSLT Stylesheet in C#

Community
  • 1
  • 1
MDev
  • 46
  • 2
  • This is my generated class: http://pastebin.com/mSpD2cMP Is it possible to take a value (in this case "slug") from an other class? The main information of the schedule is in timetable. From there I need to replace all the attributes. So instead of the identifier I need the slug part from another class – LeonM Apr 02 '12 at 19:59