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

Re: XSL omit part of a text inside TAG

Subject: Re: XSL omit part of a text inside TAG
From: buddhi <buddhi@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 07 Mar 2008 17:19:05 +0530
Re:  XSL omit part of a text inside TAG
Hi,

But the problem is, there can be other <fontface> tags too, in my future ones... I want this Path replacement ONLY to be done only for <VisualObject> tags with attribute "CBarCode".

- Regards

- Buddhi -

David Carlisle wrote:
You only want to affect FontFace, so move your template matching down to
that element rather than matching its parent. Also as a general comment
if you have a tempolate that only consists of an xsl:chhose or xsl:if
block it's often better to simplify it to put the test into the match
pattern, so rather than match on all FontFace and then check that teh
parent has the right xsl:type, I just match on the ones you want to
affect.


David



<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xsl:template match="/">
<xsl:apply-templates select="*"/>
</xsl:template>


<xsl:template match="@* | node()">
  <xsl:copy>
    <xsl:apply-templates select="@* | node()"/>
  </xsl:copy>
</xsl:template>

<xsl:template match="VisualObject[@xsi:type='CBarCode']/FontFace">
  <xsl:copy>
    <xsl:call-template name="while">
      <xsl:with-param name="foo" select="."/>
    </xsl:call-template>
  </xsl:copy>
</xsl:template>

<xsl:template name="while">
  <xsl:param name="foo"/>
  <xsl:choose>
    <xsl:when test="contains($foo,'\')">
      <xsl:call-template name="while">
	<xsl:with-param name="foo" select="substring-after($foo,'\')"/>
      </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
      <xsl:value-of select="$foo"/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

</xsl:stylesheet>

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.