|
Subject: [xsl] Efficiency, use param in key? From: Christopher_Dant@xxxxxxxxxxxxxx Date: Fri, 2 Aug 2002 18:36:44 -0700 |
On working a stylesheet that processes a multimedia-course storyboard and
returns text, CRLF-delimited, sorted, lowercase, no-duplicates filenames I
have several questions:
1. is there anything I should do to improve it (make it more efficient)?
2. is it possible to use the param "ele" in key, apply-templates and
template? This would make it possible for a single stylesheet to look for
file_audio, file_video or file_graphic tags.
3. Or perhaps I should actually ask, is there a way to rework my approach
so I can parameterize it?
Stylesheet:
<xsl:output method="text" encoding="ISO-8859-1" indent="no"/>
<xsl:param name="ele">file_audio</xsl:param>
<xsl:variable name="lc" select="'abcdefghijklmnopqrstuvwxyz'"/>
<xsl:variable name="uc" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
<xsl:key name="fn" match="file_audio" use="@fileref"/>
<xsl:template match="/">
<xsl:apply-templates select="//file_audio">
<xsl:sort select="@fileref"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="file_audio[generate-id() = generate-id(key('fn',
@fileref)[1])]">
<xsl:value-of select="translate(@fileref, $uc, $lc)"/>
<xsl:text disable-output-escaping="yes">
</xsl:text>
</xsl:template>
Excerpts of sample input:
<frame id="01" type="a" parms="a">
<txt_scr lang="ENG"/>
<txt_aud>Click on a button in front of the module you wish to begin
and...</txt_aud>
<file_audio fileref="coursemenu.mp3"/>
</frame>
.
.
.
<frame id="01">
<txt_scr lang="ENG">Welcome to the Intercom Plus training!</txt_scr>
<txt_avi>{Zelda} Hi, welcome to the Intercom Plus Training! I am Zelda
Morales...</txt_avi>
<file_avi start_frame="1" end_frame="359" fileref="__A_.0010.001.avi" />
</frame>
.
.
.
TIA
Chris
Christopher Dant
Technology Director
Jack Morton Worldwide
Christopher_Dant@xxxxxxxxxxxxxx
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] need help explaining one , Matthew L. Avizinis | Thread | Re: [xsl] Efficiency, use param in , Robert S. Koberg |
| Re: [xsl] Re: Capturing/testing res, Mike Brown | Date | [xsl] Re: Efficiency, use param in , Dimitre Novatchev |
| Month |