Re: [xsl] which is more effiecient and fast doc() or collection()

Subject: Re: [xsl] which is more effiecient and fast doc() or collection()
From: Mario Madunic <hajduk@xxxxxxxx>
Date: Thu, 26 Jun 2008 07:20:06 -0700
I'm redfaced, my question should have been the other way around as I'm already
using collection(). (Too many projects on the go). But my question still stands,
which is better?

I have a variable that contains the names of the dirs I'm using and then
tokenize it and test its current value.

Also I've cheated a bit. Since members of the project I'm working on have little
knowledge and apps for XSD/DTD, I parsed the XSD to create a simplified XSD (non
compliant but easily read) in which I resolve all groups. I only output the
children's info except if its name is body, then output the info of the childred
of body. I keep the sequence element but toss the choice (children of choice are
output though). This is the structure I parse instead of the XSD directly.

Here is a snippet of code where I parse the dirs.

<xsl:for-each select="tokenize($g_XSDDirs, ',')">

 <xsl:variable name="l_Dir" select="." />

 <xsl:choose>
  <xsl:when test="$l_Dir = 'block' or $l_Dir = 'objects' or $l_Dir = 'inline' or
$l_Dir = 'metadata'">
   <xsl:for-each select="collection(concat('../../simplifiedXSD/', .,
'?select=*.xml'))">
    <xsl:variable name="l_FileNameMinusExt"
select="substring-before(tokenize(base-uri(), '/')[last()], '.')" />
    <xsl:result-document href="../readMe/svg/{$l_Dir}/{$l_FileNameMinusExt}.svg"
method="xml" encoding="utf-8" indent="yes">
     <svg xmlns="http://www.w3.org/2000/svg"; version="1.1"
width="{$l_ViewPortLength}" height="43" viewBox="0 0 {$l_ViewPortLength} 43">
      <xsl:apply-templates />
     </svg>
    </xsl:result-document>
   </xsl:for-each>
  </xsl:when>
  <xsl:otherwise>
   <!-- do nothing -->
  </xsl:otherwise>
 </xsl:choose>
</xsl:for-each>


Quoting Andrew Welch <andrew.j.welch@xxxxxxxxx>:

> > I'm mainly using doc() with a regex to parse the various directories of
> > XSD files.
> 
> How are you doing that?  Can you provide an example?
> 
> 
> 
> -- 
> Andrew Welch
> http://andrewjwelch.com
> Kernow: http://kernowforsaxon.sf.net/

Current Thread