Within my style sheet I need to be able to map between pairs of strings
(in this case, long and short titles).
I've tried to implement this by using an internal document-node()
variable that defines the mapping and then using a function to do
lookups against the map.
The map looks like this (declared as a stylesheet-scope variable):
<xsl:variable name="sectionTitleMap" as="document-node()">
<longtitle>Overview and Background</longtitle>
<longtitle>Scope and Scope Exceptions</longtitle>
<longtitle>Topical Definitions - Glossary</longtitle>
I then have this function to do lookups:
<xsl:when test="count($sectionTitleMap//longtitle[. =
$sectionBaseTitle]) = 1">
<xsl:sequence select="$sectionTitleMap//item[longtitle[. =
As far as I can see this should just work, assuming my input parameter
occurs in the table.
However, what I'm getting is that this works as expected for *some*
input strings but not for others, where I've verified that the input
strings match the values in the map.
I must be doing something wrong but I can't figure out what it might
be--the fact that some input values work and others don't is odd.
Anyone have any idea what might be going wrong or what I can do to track
down the bug? I've done things like copied a mapping target from my
input document into the map just to be 100% sure the string is the same,
but I still get the failure, so it doesn't appear to be something subtle
like invisible characters in the input or some such (which I wouldn't
expect in this case, but you never know).
The real mapping is small enough I could rewrite the code to use
choose/when for the mappings but this seemed like the most efficient way
to do a two-way mapping in XSLT.
W. Eliot Kimber
8500 N. Mopac, Suite 402
Austin, TX 78759
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>