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

Re: recognize character entities

Subject: Re: recognize character entities
From: Florent Georges <darkman_spam@xxxxxxxx>
Date: Wed, 30 Aug 2006 10:41:39 +0200 (CEST)
poser character
Frank Marent wrote:

  Hi

> we have to change by xslt all m:mo elements that consist
> of one special character (entity reference) to symbol font
> for output. the input is coming from design science
> mathflow on arbortext editor:

>    <m:mo>&divide;</m:mo>

>    to

>    <m:mo fontfamily="Symbol">&divide;</m:mo>

> this is to address the correct font in the output

  So I'll guess you have to add the attribute to each m:mo
element where the content is equal to the value of the
entity (of one of the entities), whatever it has been
represented as an entity reference or plain text.

  So you don't have to know if there was an entity reference
or not.  Just match on the value of the entities:

    <xsl:variable name="entity.values"
                  select="('&#...', '&#...', ...)"/>

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

    <!-- If XSLT 2.0 -->
    <xsl:template match="m:mo[. = $entity.values]">
      <xsl:copy>
        <xsl:attribute name="fontfamiliy" select="'Symbol'"/>
        <xsl:apply-templates select="@*|node()"/>
      </xsl:copy>
    </xsl:template>

    <!-- If XSLT 1.0 -->
    <xsl:template match="m:mo">
      <xsl:choose>
        <xsl:when test=". = $entity.values">
          <xsl:copy>
            <xsl:attribute name="fontfamiliy" select="'Symbol'"/>
            <xsl:apply-templates select="@*|node()"/>
          </xsl:copy>
        </xsl:when>
        <xsl:otherwise>
          <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
          </xsl:copy>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:template>

  Regards,

--drkm




















	
 p5.vert.ukl.yahoo.com uncompressed/chunked Wed Aug 30 07:13:39 GMT 2006 
	
		
___________________________________________________________________________ 
Dicouvrez un nouveau moyen de poser toutes vos questions quelque soit le sujet ! 
Yahoo! Questions/Riponses pour partager vos connaissances, vos opinions et vos expiriences. 
http://fr.answers.yahoo.com 

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.