David Carlisle wrote:
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.
usual cause of cause is user error, strings that look the same but
aren't due to white space or whatever. Can you post an actual example
that fails to match?
Input data is:
<title>Overview and Background</title>
The corresponding mapping entry is:
<item>
<shorttitle>Background</shorttitle>
<longtitle>Overview and Background</longtitle>
</item>
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.
Normaly I'd use a key for such lookups, which ought to be more efficient
(or as efficient if your optimizing xslt engine decided to make an
internal key anyway)
<xsl:key name="x" match="item" use="shorttitle"/>
Makes sense. I'll try that and see if the problem goes away.
those two bits aren't needed (but perhaps documenting them is good form)
as the default behaviour is to implictly make a document node (for xslt
1 compat, mainly) or maybe that's the cause of your lookup failures,
perhaps sometimes you have got duplicated short titles?
Since I define the mapping, each value occurs exactly once. My failure
condition is that my count check returns zero when it should return 1
(as opposed to returning 2 when it should return 1).
Cheers,
Eliot
--
W. Eliot Kimber
Professional Services
Innodata Isogen
8500 N. Mopac, Suite 402
Austin, TX 78759
(214) 954-5198
ekimber(_at_)innodata-isogen(_dot_)com
www.innodata-isogen.com
--~------------------------------------------------------------------
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>
--~--