[oXygen-user] Author : Number of characters

Radu Coravu
Mon May 10 04:17:38 CDT 2010


Hi Isabelle,

We have some plans to add actions in Oxygen for counting words and 
characters.
In the meantime you can create an XSLT stylesheet with the following 
content:

<xsl:stylesheet version='1.0'
     xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

<xsl:template match='/'>
<xsl:text>The document contains </xsl:text>
<xsl:call-template name='add'>
<xsl:with-param name='nodes' select='//text()'/>
</xsl:call-template>
<xsl:text> characters.
</xsl:text>
</xsl:template>

<xsl:template name='add'>
<xsl:param name='sum' select='0'/>
<xsl:param name='nodes' select='/..'/>

<xsl:choose>
<xsl:when test='not($nodes)'>
<xsl:value-of select='$sum'/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name='add'>
<xsl:with-param name='sum'
                         select='$sum + string-length($nodes[1])'/>
<xsl:with-param name='nodes'
                         select='$nodes[position() != 1]'/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

and apply it on the XML file.
If you need to count words, there is an XSLT stylesheet available here:
http://tech.groups.yahoo.com/group/dita-users/message/11854

Regards,
Radu

-- 
Radu Coravu
<oXygen/>   XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com



On 5/7/2010 5:19 PM, Rogie Isabelle wrote:
>
> Hi,
>
> Is it possible to know simply the number of characters in a xml file?
>
> I use Author version 10.2 on Mac OS X.
>
> Best Regards,
>
> _______________________________________
>
> **Isabelle Rogie**
>
> Database Chief project
>
> Wolters Kluwer France
>
>
> _______________________________________________
> oXygen-user mailing list
> 
> http://www.oxygenxml.com/mailman/listinfo/oxygen-user
>    





More information about the oXygen-user mailing list