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

RE: Exclusive formatting..

Subject: RE: Exclusive formatting..
From: "Chris Bayes" <chris@xxxxxxxxxxx>
Date: Sun, 26 Aug 2001 18:07:37 +0100
xsl template match exclusive
James,
Your phantom values are coming from the builtin templates.

<page>
   <news name="Test">
      <author>Me</author>
      <guts>
     	This is Line 1. 
     	And this is Line 2.
      </guts>
   </news>
</page>

When you process the news element with this template

<xsl:template match="news">
		<p></p><b>Subject:</b>  <xsl:value-of select="@name"
/><br/>
  		<em>Author:</em>  <xsl:value-of select="author" /><br/>
		<xsl:value-of select="guts" />
        <xsl:apply-templates />
</xsl:template>

It creates your required output but then you do an apply-templates and
the builtin templates process the author and guts elements outputting
their text. Change it to 

<xsl:template match="news">
		<p></p><b>Subject:</b>  <xsl:value-of select="@name"
/><br/>
  		<em>Author:</em>  <xsl:value-of select="author" /><br/>
		<xsl:value-of select="guts" />
</xsl:template>

If you have no other elements you want to process or to

<xsl:template match="news">
	<p></p><b>Subject:</b>  <xsl:value-of select="@name" /><br/>
	<xsl:apply-templates />
</xsl:template>

And add

<xsl:template match="author">
  		<em>Author:</em>  <xsl:value-of select="." /><br/>
</xsl:template>
<xsl:template match="guts">
		<xsl:value-of select="." />
</xsl:template>

If there are other elements you want to process

Ciao Chris

XML/XSL Portal
http://www.bayes.co.uk/xml


> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> J.Brown (Ender/Amigo)
> Sent: 26 August 2001 16:41
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Exclusive formatting..
> 
> 
> Hey all,
> 	I've been trying to maintain a large app at work that 
> uses an XML stylesheet to return valid HTML from XML 
> documents stored in a CVS repositry.
> 
> To make the story short, I've been trying to learn XSL in the 
> vauge hope it'll make life easier if I know what I'm trying 
> to maintain :)
> 
> But I've already ran into a problem. I want to create a 
> stylesheet that will basically take in a "page" element, 
> containing multiple "news" items. Each "news" item will have 
> a "author" value, a subject (the name of the item), and a set of text.
> 
> For some reason the stylesheet I'm using prints the formatted 
> text fine, but then images the original text. I'm sure 
> there's a fundimental concept I'm missing here :)
> 
> Eg, I want this:
>   <HTML><HEAD><TITLE>A page</TITLE></HEAD><BODY>
>    Subject: Blah
>    Author:  Me
>     Hello, I am a news item.
>     This is line 2.
>   </BODY></HTML>
> 
> What I get is this:
>   <HTML><HEAD><TITLE>A page</TITLE></HEAD><BODY>
>    Subject: Blah
>    Author:  Me
>     Hello, I am a news item.
>     This is line 2.
> 
>   Me Hello, I am a news item.
>   This is line 2.
>   </BODY></HTML>
> 
> With the second part just a phantom.
> 
> Here's the XML I'm starting with:
> 	www.nehahra.com/test.xml
> 
> Here's the XSL I'm trying to apply:
> 	www.nehahra.com/test.xsl
> 
> Thanks in advance :)
> 
> Regards,	| If I must have computer systems with publically
> 	 Ender  | available terminals, the maps they display of 
> my complex
>   (James Brown)	| will have a room clearly marked as 
> the Main Control Room.
> 		| That room will be the Execution Chamber. The 
> actual main
> 		| control room will be marked as Sewage 
> Overflow Containment.
> 
> 
>  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.