xsl-list
[Top] [All Lists]

Re: [xsl] recognize character entities

2006-08-30 02:22:29
georges, david

the problem is i have to address around 2000 different entity references that can appear (Α Β &Epsilon ... ‾ ⁄ ℵ ... ⩱ %hercon; ... ... ...). if i understand your way correctly, so

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

would become quite a statement.

concerning the mail of david:

we have a problem within mathml

impossible!

you're right! :-) the problem is actually not within mathml but caused by an application that needs an additional fontfamily attribute if we're using entity references.

as far as i understand the pathes proposed there is not a statement that can select *all* entity references at once...?

best regards
frank



Am 30.08.2006 um 10:41 schrieb Florent Georges:

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
        
                
______________________________________________________________________ _____ Découvrez un nouveau moyen de poser toutes vos questions quelque soit le sujet ! Yahoo! Questions/Réponses pour partager vos connaissances, vos opinions et vos expériences.
http://fr.answers.yahoo.com


--~------------------------------------------------------------------
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>
--~--



--~------------------------------------------------------------------
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>
--~--