tags:

views:

53

answers:

2

hi,

need help on an xml task, im new to xml. the task is to build a xml catalogue which has 4 genres of music with two examples know i have manged to make that but im having difficulty write the code for the xsl stylesheet

+2  A: 

I'm not going to do your homework but I can recommend a very good tutorial resource: http://www.zvon.org/xxl/XSLTutorial/Books/Book1/index.html which gives many examples of simple XSLT in action.

You could iterate (xsl:for-each) over all the rock children and then select each child in sequence and create whatever output XML you want (you will need to design this anyway)

peter.murray.rust
ive managed to get it working using the website but only one of the rock shows ive still got 3 more genres and 7 more example how do i show them and i didnt understand (xsl:each)
jj
+2  A: 

W3Schools has some good resources as well. http://www.w3schools.com/xsl/default.asp http://www.w3schools.com/xpath/default.asp

Here is a spec on XML Catalogs: http://www.oasis-open.org/committees/entity/spec-2001-08-06.html

One thing to keep in mind while writing XSL is that you are dealing with sets. Anytime you use a select attribute it returns a set of nodes, even if it is a set of 1.

Look into xsl:element and xsl:attribute for creating new elements and attributes.

Guster_Q
Christ, I can't stand that w3schools site, do you really like it?
Phil Booth
They have a lot of really good information. I have used it many times.
Guster_Q