Subject: Re: Mixed content transformation From: Guy_Murphy@xxxxxxxxxx Date: Thu, 14 Jan 1999 15:13:23 +0000 |
Hi. MS can handle it at the moment, but you need to include the template... <xsl:template> <xsl:value-of /> </xsl:template> ...in order to process what are in effect inline elements. So our complete XSL would look something like. <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"> <xsl:template> <xsl:choose> <xsl:when match=".[nodeType()='7']"> <!-- PI Node --> <xsl:comment><xsl:value-of /></xsl:comment> </xsl:when> <xsl:otherwise> <xsl:value-of /> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="/"> <html> <head> <title>Test</title> </head> <body> <xsl:apply-templates /> </body> </html> </xsl:template> <xsl:template match="foo"> <p> <xsl:apply-templates /> </p> </xsl:template> <xsl:template match="bar"> <b><xsl:apply-templates /></b> </xsl:template> </xsl:stylesheet> Note that here I'm filtering out PIs, although there is an easier method that somebody on the list contributed, I just can't find it. The only advantage with the above is that you could concievably handle PIs in some special way, but overall it will do what you want. I though that <xsl:template match="text()"> would do, but the IE5b2 parser compains that this isn't returning a node. ::shrug:: somebody's bound to clear it up. Cheers Guy. xsl-list@xxxxxxxxxxxxxxxx on 01/14/99 04:59:42 PM To: XSL-List@xxxxxxxxxxxxxxxx cc: (bcc: Guy Murphy/UK/MAID) Subject: Mixed content transformation I have a simple question, but I couldn't find any references to it in the XSL working draft. How can I transform mixed content using XSL? I think I remember hearing that Microsoft can't handle it at this point, but I didn't even see it covered in the working draft. For example, lets say I have this simple XML snippet: <foo>This is <bar>mixed</bar> content.</foo> What would my XSL look like to transform this to: <P>This is <B>mixed</B> content.</P> Am I missing something obvious? Thanks a bunch, Paul XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Mixed content transformation, Keith Visco | Thread | Re: Mixed content transformation, G. Ken Holman |
Re: Mixed content transformation, Keith Visco | Date | cdata was: XSL and HTML, David Carlisle |
Month |