[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Mixed content transformation

Subject: Re: Mixed content transformation
From: Guy_Murphy@xxxxxxxxxx
Date: Thu, 14 Jan 1999 15:13:23 +0000
xsl transform mixed content
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.