I have Hamlet in XML. I'm to write a stylesheet. I'm stuck on the <persona> tag. Any help would be greatly appreciated. The "apply-template" doesn't seem to iterate through the <persona> tag and I can't get the for-each loop to work.
What I have so far:Code:<XML> <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type="text/xsl" href="hamlet.xsl"?> <PLAY> <TITLE>The Tragedy of Hamlet, Prince of Denmark</TITLE> <FM> <P>Text placed in the public domain by Moby Lexical Tools, 1992.</P> <P>SGML markup by Jon Bosak, 1992-1994.</P> <P>XML version by Jon Bosak, 1996-1998.</P> <P>This work may be freely copied and distributed worldwide.</P> </FM> <PERSONAE> <TITLE>Dramatis Personae</TITLE> <PERSONA>CLAUDIUS, king of Denmark. </PERSONA> <PERSONA>HAMLET, son to the late, and nephew to the present king.</PERSONA> <PERSONA>POLONIUS, lord chamberlain. </PERSONA> <PERSONA>HORATIO, friend to Hamlet.</PERSONA> <PERSONA>LAERTES, son to Polonius.</PERSONA> <PERSONA>LUCIANUS, nephew to the king.</PERSONA>
Code:<?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <head><title><xsl:value-of select="PLAY/TITLE"/></title></head> <body> <xsl:apply-templates select="PLAY"/> </body> </html> </xsl:template> <xsl:template match="PLAY"> <xsl:value-of select="FM" /><br /><br /> <xsl:value-of select="PERSONAE/TITLE" /><br /> <xsl:value-of select="PERSONAE/PERSONA"/> </xsl:template> </xsl:stylesheet>




Reply With Quote