xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Muench" <smue...@us.oracle.com>
Subject Re: XSL question
Date Thu, 06 Jan 2000 17:53:28 GMT
Try something like with <xsl:copy-of>, like...

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">

  <xsl:template match="/">
    <html>
    <body>
      <h1>Table of Widgets</h1>
      <table>
        <xsl:apply-templates select="/document/widgets/widget"/>
      </table>
    </body>
    </html>
  </xsl:template>

  <xsl:template match="widget">
    <!-- Show the title in the right color -->
    <tr><th>
      <xsl:value-of select="widgetTitle"/></th>
    </tr>
    <tr><td style="background: {widgetColor}">
    <xsl:copy-of select="widgetContent"/>
    </td>
    </tr>
  </xsl:template>

</xsl:transform>
_________________________________________________________
Steve Muench, Consulting Product Manager & XML Evangelist
Business Components for Java Development Team
http://technet.oracle.com/tech/java
http://technet.oracle.com/tech/xml
----- Original Message -----
From: "Brett McLaughlin" <bmclaugh@algx.net>
To: <general@xml.apache.org>
Sent: Thursday, January 06, 2000 9:22 AM
Subject: XSL question


| All-
|
| I know this belongs on XSL-List.  I posted it there, but need an answer
| like yesterday, so I'm asking here too.  Thanks for any help:
|
| All-
|
|         I am having problems doing something like the following:
|
| <document>
|  <widgets>
|   <widget>
|    <widgetTitle>My Widget</widgetTitle>
|    <widgetColor>Silver</widgetColor>
|    <widgetContent>
|     <table><tr><td>
|       Some more HTML content.
|     </td></tr></table>
|    </widgetContent>
|   </widget>
|  </widgets>
| </document>
|
| My styelsheet, when doing <xsl:apply-templates
| select="//document/widgets/widget/widgetContent" /> only prints "Some
| more HTML Content", leaving out the HTML tags.  In my doc, I have
| everything (of mine) prefixed with a namespace, and the HTML is in the
| default namespace.  I referenced the correct namespace URI (and it makes
| everything cleaner), but my XSL is still ignoring the HTML tags because
| I have no template defined.  How can I tell XSL to put these out "as is"
| (obviously a CDATA section doesn't work).  THanks.
|
| -Brett
|


Mime
View raw message