Thanks for your advice on this. I understand now the reasons
behind not allowing newline-ended comments. After reading
Colin Adams comments, and Frans Englich's, I came up with the
following as a best-practice for
ourselves:
<xsl:variable name="re-extract-filename" >
^.*? <!-- non-greedy: grab everything -->
([^/\\]+) <!-- filename in $1 -->
\. <!-- extension-dot -->
[^\.]*$ <!-- extension (not-a-dot*) -->
</xsl:variable>
<xsl:value-of select="replace(., $re-extract-filename,
'$1.xml', 'x')" />
That seems an excellent suggestion. Putting the regex in a text node rather
than an attribute node also means that quote characters don't need to be
escaped (and for xsl:analyze-string, curly braces don't need to be doubled).
I'd just add one improvement: add the attribute 'as="xs:string"' to the
variable declaration, so that the value is a string rather than a document.
Michael Kay
--~------------------------------------------------------------------
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>
--~--