xsl-list
[Top] [All Lists]

Re: [xsl] XSL omit part of a text inside TAG

2008-03-07 04:34:31


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[(_at_)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>

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--