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

variables and inline tags

Subject: variables and inline tags
From: Spencer Tickner <spencertickner@xxxxxxxxx>
Date: Wed, 4 May 2005 13:52:35 -0700
inline tags
Having problems with variables, applying templates and parsing
strings. Been working on it all day and can't seem to wrap my mind
around it.

Here is my simplified xml:

<definition>
  <term>recognized</term>
  <def>, under the <em>Company Act</em></def>
</definition>

What I need to do is substring the def information when it starts with
a comma, ie:

with comma
<p class="def">"recognized", under the <em>Company Act</em></p>

without comma
<p class="def">"recognized" under the <em>Company Act</em></p>

Ok, there's the background. I'm having problems because I'm using a
variable to parse out the unwanted space in the with comma example
above, then to get the variable I use a value-of statement which
promptly drops the <em> tags. Any suggestions or advive would be
appreciated.


Here's my simplified xsl:

<!-- Defintion -->
<xsl:template match="definition" mode="contentsection">
	<p class="def">
	<xsl:choose>
	<xsl:when test="substring(def, 1, 1)=','">
		<strong>"<xsl:apply-templates
select="term"/>"</strong>,&#160;<xsl:variable name="uncommadef">
			<xsl:apply-templates select="def"/>
		</xsl:variable>

                 <!-- Problem is here -->
		<xsl:value-of select="substring($uncommadef, 2)"/>
	</xsl:when>
	<xsl:otherwise>
		<strong>"<xsl:apply-templates
select="term"/>"</strong>&#160;<xsl:apply-templates select="def"/>
	</xsl:otherwise>
	</xsl:choose>
	</p>
 </xsl:template>
 <xsl:template match="term">
 	<xsl:apply-templates select="text()|strong|em|sup|sub|u|insert|br|eacute"/>
 </xsl:template>
 <xsl:template match="def">
 	<xsl:apply-templates select="text()|strong|em|sup|sub|u|insert|br|eacute"/>
 </xsl:template>
<!-- End of Definition -->

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.