It Works!
Thanks for you help, Jon and Michael. I really appreciate it. Plenty
more to study, that's for sure.
I found I had something complicating things. I was trying to rename
(make a new) element that contains the directory name. (That's the
"BasePath" node below.) After I used the existing name, I had more success.
Thanks,
Don
.......
Here's the solution:
=========== The XSLT ====================
<!-- Set the value of the images directory name variable. -->
<xsl:variable name="dirname">
<xsl:value-of
select="concat(translate(normalize-space(/Presentation/BuiltinProperties/BasePath),'
','_'),'/images/')"/>
</xsl:variable>
<!-- Rename the Filename element -->
<!-- I did this to avoid conflict with the other 'Filename' node below.
I want to distinguish between them for reasons later in the
process. -->
<xsl:template match="Presentation/Filename">
<xsl:element name="Source">
<!-- I did this to see if I could. I could! -->
<xsl:attribute name="file">
<xsl:value-of select="$dirname"/>
</xsl:attribute>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<!-- Concat path onto filename of image, and change from swf to tif. -->
<xsl:template match="Filename">
<xsl:element name="Filename">
<xsl:value-of select="$dirname" /><xsl:value-of
select="replace(.,'.swf','.tif')"/>
</xsl:element>
</xsl:template>
<!-- I have a couple of other things here... like changing the order of
the nodes in Slide -->
============= The Before XML ===============
The original BasePath Node:
<BasePath>IC 3 - Lesson 1 Expertise</BasePath>
And the (partial) Slide Node:
- <Slide id="1">
<Filename>slide1.swf</Filename>
<BackgroundFile>bgtm1.swf</BackgroundFile>
<Title>Expertise and Effective Office Warning Strategies</Title>
</Slide>
=========================================
============= After the Transform ==============
- <Slide id="1">
<BackgroundFile>bgtm1.swf</BackgroundFile>
<Title>Expertise and Effective Office Warning Strategies</Title>
<Filename>IC_3_-_Lesson_1_Expertise/images/slide1.tif</Filename>
</Slide>
=========================================
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--