Jump to content

Is this the right use for xml?


roondog
 Share

Recommended Posts

Just looking through the xml tutorials and i'm thinking of doing a sporting fixtures page using xml. so I was thinking i use an xml file to save all the data for the fixtures something like:

<fixture><date>15/04/07</date><opponent>team A</opponent><venue>Sports ground</venue></fixture>

i could then style it with css or xsl but how would i do the rest of the page can you use xml files as php includes or is this the wrong way to be using xml.

Link to comment
Share on other sites

fixtures? What do you mean by that (I'm not a native English speaker, mind you)?Anyhow, yes you could do something like that. And yes, you can use a sort of includes on XML files, though such could be (or not) slightly different then SSI includes.In XSLT, you can fetch any document, other the one being styled with the document() function, and scince you can apply a single XSLT file to a set of XML documents, this makes the fetched XMLs with document() kind'a included, but even what's fetched with it must be transformed somehow. You could always just copy-of it in the output though, and this makes it pretty much like SSIs (only it doesn't have to be on the server, but that's another subject).P.S. I suggest that for the date, you use attributes on the date element itself, like this:

<date day="15" month="4" year="2007"/>

It's far more easier in XSLT and any other XML enabled language to manipulate the value of a whole node ("node" meaning element, attribute, text, etc.) instead of part of it (part of it's text content that is). Having this or similar structure will allow you for example to map the month value to a month name, sort the events by either year, month or day, and all of it with a lot more ease.

Link to comment
Share on other sites

Thanks for that. I think I'll keep reading through the tutorials and i'm sure all will become clear. A fixture is a date in a sporting calendar e.g a game of football. So the fixtures for a team would be a list of all their games.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...