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

Displaying only first Text node

Subject: Displaying only first Text node
From: Horace Burke <xmlmarkup@xxxxxxxxx>
Date: Wed, 12 Dec 2007 09:52:58 -0800 (PST)
 Displaying only first Text node
Hi All,

I am trying to capture/display only the first text node (product name) in
a paragraph tag ("<para>") which has the product name separated by line
break ("<br>") tags. I got as far as identifying the location but I can't
get only the product name before the first line break tag to display.

Please see my XML and XSL snippets below and I hope someone will be able
to give me some pointers on what I am doing wrong.

Thanks in advance for your help, I really appreciate it.


Regards,
Horace Burke

<===XML===>

<!--In this instance for example I only want to display the text
"T8-FITC/NKH-1-RD1"-->
<ProdName>
  <title>Product Name</title>
 
<para>T8-FITC/NKH-1-RD1<br/>T4-FITC/4B4-RD1<br/>T4-FITC/2H4-RD1<br/>T11-RD1/B4-FITC...</para>
</ProdName>

<===END XML===>

<===XSL-FO===>
<!--This is displaying all the product names, so I know that I am really
missing something here -->
<xsl:template match="para" mode="ProdName_BR">
   <xsl:choose>
      <xsl:when test="parent::ProdName and child::br">
	 <xsl:if test="position()=1">
	    <xsl:apply-templates select="node()"/>
	 </xsl:if>
      </xsl:when>
   </xsl:choose>
</xsl:template>


      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 

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.