• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

xsl:when expressions

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
is there any limit on number of expressions with in <xsl:when>
..
<xsl:when test="starts-with(EVENT,'xxxxxx') or
starts-with(EVENT,'yyyyyy') or
starts-with(EVENT,'gggggg') or
starts-with(EVENT,'yyyyyy') or
starts-with(EVENT,'rrrrrrr') or
starts-with(EVENT,'ghgfhgfhgf') or
.
.
.
.
.
.so on
when I try add few more lines condtions
I am getting javax.xml.transform.TransformerConfigurationException..
Is there any limit on number of lines

Pls help ..
Thanks in advance..
 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the problem goes away when you delete (or comment out) some, then either there is a limit or the ones you deleted are coded wrong.
Since all of the starts-with functions are in a single string, there may be a limit on the length of the string.
But, I think you are in luck. If your xsl:when test is just a series of starts-with's separated by or's, you can make more than one xsl:when groups. If the EVENT doesn't match one of the strings in the first xsl:when, it will look for the next xsl:when. Pick a reasonable size and put 5-10 of them in each xsl:when block.
I don't know the overhead of processing a compound test (x or y or z) vs. separate xsl:when statements. It might be faster to put each test in a separate xsl:when.
 
David Patterson
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had another idea. Rather than code dozens of
test strings into the code of the stylesheet,
look at the "document(...)" function. It allows
you to code an XML data section in your stylesheet
or to refer to an external file with XML data.
For example, you can set a variable to the
node set in an external file with:

This new variable can be searched with XPATH-style
tests to locate a match.
For example, something like:

This assumes your xml data file is like:

From a maintainability point, it is much better
to have the data in a separate file especially
if it changes from time to time.
 
A sonic boom would certainly ruin a giant souffle. But this tiny ad would protect it:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic