[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] [XSL 1.0] How to use apply-templates to process a sub
This is a real basic question, I think, but I can't get my head around it. Given this XML: <root> <story> <Head>This is the title</Head> <Body>This is the body <Big>some of it is bold</Big> and some isn't</Body> <Body>This is some more body text.</Body> </story> </root> And this XSL: <xsl:stylesheet> <xsl:template match="/"> <html> <body> <xsl:apply-templates select="Root" /> </body> </html> </xsl:template> <xsl:template match="Head"> <h1><xsl:value-of select="."/></h1> </xsl:template> <xsl:template match="Body"> <p><xsl:value-of select="."/></p> </xsl:template> <xsl:template match="Big"> <bold><xsl:value-of select="."/></bold> </xsl:template> </xsl:stylesheet> I'm trying to convert the XML to HTML with XSL. I've got it all figured out and working, except for the <Big> text. I don't understand how to recursively get to the <Big> element when it is a sub-element of <Body>. All the examples I've read about in all my books expect the XML to be: <Body> <Big>text here</Big> </Body> But this is a different structure, where the <Big> element is in the middle of the Body element. Can anyone shed some light on how I get to the <Big> element with apply-templates? Thanks! ~ Keith
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|