consider my ‘destinationURLLookUp.xml’ file has the following structure
<?xml version="1.0" encoding="UTF-8"?>
<destinationURLs xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<destinationURL name="Default Page" value="/abc/ab"/>
<destinationURL name="Home Page" value="/abc/ac"/>
</destinationURLs>
I’m loading this file in my XSLT using the following XSLT code and have to retrieve the corresponding ‘name’ attribute for the ‘value’ that i’m processing for the
<destinationURL>
tag.
XSLT snippet that i have tried
<xsl:variable name="prop" select="document('destinationURLLookUp.xml')"/>
<xsl:variable name="rep2" select="$prop/destinationURLs/destinationURL[@value=@url]/@name"/>
<xsl:value-of select="$rep2" />
where @url is the url value that i will get which matches the ‘value’ attibute of
<destinationURL>
tag. I’m unable to get the output.Can i get the relative xpath for accessing ‘name’ attribute for the corrsponding ‘value’ matched.
tried with $prop/destinationURLs/destinationURL[@value=@url]/@name
shown above.
I think you are just missing to explicitly specify the template current contenxt for the
@urlattribute. The correct XPath depends by the template where your instruction is placed.I’m speaking about something like this:
Do note
current()/@url.