The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> XML to HTML using XSL
brownowl100
post Dec 30 2007, 10:05 AM
Post #1





Group: Members
Posts: 2
Joined: 30-December 07
Member No.: 4,607



Hi everyone, i have a problem if anyone could help me i would be much grateful, i am im my third year of university at Liverpool, revising for my finals in Jan, i have a question i am struggling with atm. its the conversion of XML to HTML by XSL. i will past the question and show you what i think, ive read tutorial after tutorial on XSL and i kinda have the jist of it, but i dont think i am right about the questions, any help would be great......

here is the XML document


<staff>
<woman>
<fstName> Janet </fstName>
<surname> Lowry </surname>
</woman>
<man>
<fstName> Michael </fstName>
<surname> Fisher </surname>
</man>
<woman>
<fstName> Clare </fstName>
<surname> Dixon </surname>
</woman>
</staff>


and XSL query

1<xsl:template match="/">
2<HTML><BODY><xsl:apply-templates/></BODY></HTML>
3</xsl:template>
4<xsl:template match="fstName">
5<TD><xsl:value-of/></TD>
6</xsl:template>
7<xsl:template match="surname">
8<TD><xsl:value-of/></TD>
9</xsl:template>
10<xsl:template match="man">
11<TR>
12<xsl:apply-templates select="fstName"/>
13<xsl:apply-templates select="surname"/>
14</TR>
15</xsl:template>
16<xsl:template match="woman">
17<TR>
18<xsl:apply-templates select="fstName"/>
19<xsl:apply-templates select="surname"/>
20</TR>
21</xsl:template>
22<xsl:template match="staff">
23<TABLE BORDER="l">
24<TBODY>
25<xsl:apply-templates select="man"/>
26<xsl:apply-templates select="woman"/>
27</TBODY>
28</TABLE>
29</xsl:template>

and the questions are:


(a) Is it true that this XSL query will produce the following table visible in an IE browser?
Explain why, and correct the result if necessary.

Janet Lowry
Michael Fisher
Clare Dixon

NB. i am pretty sure that this wouldnt be the order and that the order would be michael fisher, janet lowry, clare dixon??

(b) Explain how to change this XSL query so that man rows will follow woman rows in
the HTML table.

NB. would you put man at the end of the XSL code after woman???

© Explain how to change this XSL query so that fstName columns will follow surname
columns in the HTML table.

at the top of the doc, change firstname and surname around so that valueOf will output them in that order???

(d) Explain how to change this XSL query so that each row in this table will start with
the additional table cell with the word MALE or FEMALE according to the data in
the XML document.

not sure on this one????

(e) Explain how to change this XSL query so that first names will be in boldface and
surnames will be in italic.

i know you would have to include the tags <b> firstname </b> and <i> lastname </i>
but im not sure where to include these???
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 26th April 2024 - 10:47 PM