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

Re: why not match text()? (fork from "Novice Question

Subject: Re: why not match text()? (fork from "Novice Question - matching entire text children")
From: "Imsieke, Gerrit, le-tex" <gerrit.imsieke@xxxxxxxxx>
Date: Tue, 21 Dec 2010 02:28:46 +0100
Re:  why not match text()? (fork from "Novice Question
On 21.12.2010 01:21, Imsieke, Gerrit, le-tex wrote:


find . -name \*xsl | xargs grep -ch 'text()' | sed -e 's/^/.+/' | bc |
tail -1

Oops, should have used collection() with recurse=yes for this. Eat your own (or rather, Dr. Kays excellent) dogfood. The advantage of using collection() is quite clear: you can restrict the counting to text() in

Should have said more precisely: the advantage of XSLT-based counting (where XSLT means: XSLT 2.0 with its collections) is clear.


After cleanup, the result of

<xsl:stylesheet version="3.0"
xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"
xmlns:xs = "http://www.w3.org/2001/XMLSchema">
<!-- 3.0 only because of round($arg, $precision) -->
<xsl:output method="text"/>
<xsl:template name="main">
<xsl:variable name="xsldocs" select="collection('file:///c:/cygwin/home/gerrit?select=[_a-zA-Z0-9]*.xsl;recurse=yes')" />
<xsl:variable name="file-count" select="count($xsldocs)" as="xs:double" />
<xsl:variable name="text-in-pattern-count" select="count($xsldocs/*/xsl:template[matches(@match, 'text\(\)')])" as="xs:double" />
Files: <xsl:value-of select="$file-count" />
Matches: <xsl:value-of select="$text-in-pattern-count" />
Average: <xsl:value-of select="round($text-in-pattern-count div $file-count, 2)" />
</xsl:template>
</xsl:stylesheet>


is:

    Files: 971
    Matches: 971
    Average: 1

The identical value of 971 for the matches seems to be purely accidental. When looking for 'node()' instead of 'text()', match count is 644; when looking for 'br', it is 187.

There were all kinds of problems during cleanup, ranging from unresolved svn conflicts over unterminated elements (= abandoned work in progress), illegal UTF-8 characters to symlinks. We need to think about well-formedness checks on the file system level.
(These days one has to add: If mankind survives, i.e., unless JSON gains Complete World Domination.)


Gerrit

patterns. But to my embarrassment, some of the stylesheet dont seem to
be well-formed. Have to fix this first.


-- Gerrit Imsieke Geschdftsf|hrer / Managing Director le-tex publishing services GmbH Weissenfelser Str. 84, 04229 Leipzig, Germany Phone +49 341 355356 110, Fax +49 341 355356 510 gerrit.imsieke@xxxxxxxxx, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschdftsf|hrer: Gerrit Imsieke, Svea Jelonek,
Thomas Schmidt, Dr. Reinhard Vvckler

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.