xsl-list
[Top] [All Lists]

RE: Element creation

2002-12-03 13:46:22
From: David Pratt [mailto:dave(_dot_)pratt(_at_)webcoursesnow(_dot_)com]
Sent: Tuesday, December 03, 2002 1:10 PM
Subject: [xsl] Element creation


I have reviewed tutorials and hoping someone can point out why the 
style_name element is not being created and how to correct this. Help
appreciated. Thanks.

[ XML snipped ]

Perhaps it's a typo, but I noticed your close document tag was missing its
/.  (I can't imagine that is the source of your problem--your parser would
balk at it before the stylesheet ever saw it.)

XSL:

   <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
   <xsl:output method="xml"/>
     <xsl:template match="/">
       <article>
          <xsl:for-each select="/document/para">
            <xsl:element name="{style_name}">
              <xsl:value-of select="para_content"/>
            </xsl:element>
          </xsl:for-each>
       </article>
     </xsl:template>
   </xsl:stylesheet>

Am looking for this result:

<article>
   <title>This is the title.</title>
   <body>This is the body.</body>
</article>

I applied your stylesheet using MSXML 4.0, and I got the desired result.
What processor are you using?

| brian martinez                              
brian(_dot_)martinez(_at_)trip(_dot_)com |
| senior gui programmer                                  303.708.7248 |
| trip network, inc.                                 fax 303.790.9350 |
| 6436 s. racine cir.                             englewood, co 80111 |
| http://www.cheaptickets.com/                   http://www.trip.com/ |

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>