xsl-list
[Top] [All Lists]

Re: [xsl] searching for occurrences of unique string-value and replacing with string value of another node

2008-06-05 14:39:33
So sorry! I didn't get the original thread deleted before replying...

On Thu, Jun 5, 2008 at 5:28 PM, Julie 
<julie(_dot_)newcome(_at_)gmail(_dot_)com> wrote:
Thank you for your reply, Michael.

I put this code in but I do not get a result for the link, just ".html".

I can evaluate the xpath expressions through xmlspy, but this is a
function so that doesn't work...is there any other way to evaluate
what is in the key?



Using a key is a good idea. I do not understand what you mean with a 
sub-node, try this:

<xsl:key name="targetFile" match="File" use=".//CuHistoryGuid/text()"/>

<xsl:template match="RelatedLinks/CuRef">
 <a class="old" href="{(_at_)CuHistoryGuid}(_dot_)html">
    <xsl:apply-templates/>
 </a>
 <a class="new" href="{key('targetFile', 
@CuHistoryGuid)/FileGuid/text()}.html">
    <xsl:apply-templates/>
 </a>
</xsl:template>

The key "targetFile" indexes all elements File according to the text content 
of their descendant "CuHistoryGuid".


--~------------------------------------------------------------------
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>
--~--