Re: Efficiency, use param in key?
Hi Chris, [name sounds familiar, Authorware? Director?]
First, people who storyboard their projects are some of the smartest people :-D
On working a stylesheet that processes a multimedia-course storyboard and returns text, CRLF-delimited, sorted, lowercase, no-duplicates filenames I have several questions:
Second, I am not too clear on the desired outcome.
No you can't do that.
If you are making a storyboard, why do you need to get all of these at once? in sorted order?
Can you show the output you are trying to achieve?
Here you could pass in the param from the server (or a client-side app). So all you need at the top level is:
You almost never want to use '//' to find things. This is a big slowdown. Are you trying to create a report of all your media assets? If so, it might not matter that the performance is bad.
Ah.. you just want a list of assets and to ensure all the names are lowercase
You don't need the elaborate match. In your match="/" you set up everything to be fed to the template directly above. So all you need is:
I am not sure what you are trying to do here:
Chris, you can contact me offlist if you want more specific stuff as it relates to a MACR product.
I don't understand why you need to get the media assets all at once. For a storyboard that I have in mind you would want to keep the asset with the frame. Can you elaborate on what you need.
You might want to keep your assets in different files and refer to them by ID. So you might have:
[movies.xml] <movies> <movie start_frame="1" label="jkhjh" end_frame="359" id="amovie.avi"> <text id="text1.xml"/> </movie> <movie start_frame="1" label="jkhjh" end_frame="359" id="amovie2.avi"> <text id="text2.xml"/> </movie> <movie start_frame="1" label="jkhjh" end_frame="359" id="amovie_n.avi"> <text id="text_n.xml"/> </movie> </movies>
[audio_clips.xml] <clips> <clip id="amp3.mp3" label="jkhjh" more_meta_data="whatever"/> <clip id="amp3_n.mp3" label="jkhjh" more_meta_data="whatever"/> </clips>
[screen_text.xml] <screen_texts> <screen_text id="screen1.xml" label="jkhjh"/> <screen_text id="screen2.xml" label="jkhjh"/> </screen_texts>
Here, your main source document is cbt.xml. In your primary XSL you can define a key to account for all XML documents you bring into the transformation, like:
<xsl:key name="main_key" match="chapter | frame | screen_text | clip | movie | clip" use="@id"/>
As you go through you main source XML (cbt.xml) you come across your different assets you can access their specific info by doing something like:
<!-- top-level variable -->
<xsl:variable name="movies_nodeset" select="document('movies.xml')/movies"/>
<!-- perhaps you need to get all of the particular movie's info --> <xsl:template match="movie"> <xsl:variable name="movie_id" select="@id"/> <!-- change the XML context to the movies.xml so you can use key() --> <xsl:for-each select="$movies_nodeset/movie"> <xsl:apply-templates select="key('main_key', $movie_id)" mode="info"/> </xsl:for-each> </xsl:template>
<xsl:template match="movie" mode="info"> <!-- now you are in movies.xml at the node specified by the key above -->
<xsl:value-of select="@id"/> <xsl:text>, </xsl:text> <xsl:value-of select="@label"/> <xsl:text>, </xsl:text> <xsl:value-of select="@start_frame"/> <xsl:text>, </xsl:text> <xsl:value-of select="@end_frame"/> <xsl:text>, </xsl:text>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format