nlbdev / nordic-epub3-dtbook-migrator

Tools for converting between a strict subset of DTBook and EPUB3.
http://nlbdev.github.io/nordic-epub3-dtbook-migrator/
GNU Lesser General Public License v2.1
8 stars 7 forks source link

recursion error with dtbook-legacy-fix.xsl #135

Closed josteinaj closed 9 years ago

josteinaj commented 9 years ago
2014-10-30 16:02:58,954 [ERROR] com.xmlcalabash - bundle://104.0:1/xml/xslt/dtbook-legacy-fix.xsl:28:err:SXLM0001:Too many nested apply-templates calls. The stylesheet may be looping.
2014-10-30 16:02:58,955 [DEBUG] o.e.persistence.logging.default - Connection(19699893)--Thread(Thread[Thread-19,5,Configuration Admin Service])--INSERT INTO PERSISTENTMESSAGE (jobId, sequence, col, file, LEVEL, line, text, throwable, timestamp) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
    bind => [9 parameters bound]
2014-10-30 16:02:58,958 [ERROR] com.xmlcalabash - Too many nested apply-templates calls. The stylesheet may be looping.
2014-10-30 16:02:58,960 [DEBUG] o.e.persistence.logging.default - Connection(10533510)--Thread(Thread[Thread-19,5,Configuration Admin Service])--INSERT INTO PERSISTENTMESSAGE (jobId, sequence, col, file, LEVEL, line, text, throwable, timestamp) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
    bind => [9 parameters bound]
2014-10-30 16:02:58,961 [ERROR] com.xmlcalabash - Too many nested apply-templates calls. The stylesheet may be looping.
2014-10-30 16:02:58,962 [DEBUG] o.e.persistence.logging.default - Connection(31266557)--Thread(Thread[Thread-19,5,Configuration Admin Service])--INSERT INTO PERSISTENTMESSAGE (jobId, sequence, col, file, LEVEL, line, text, throwable, timestamp) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
    bind => [9 parameters bound]
2014-10-30 16:02:58,966 [INFO ] org.daisy.pipeline.job.Job - Changing job status to: DONE
josteinaj commented 9 years ago

@usama49

josteinaj commented 9 years ago

I'm unable to reproduce it on my computer. It seems to be a regex issue though: https://saxonica.plan.io/issues/1991

This regex is the most likely culprit:

<!-- ISBN is in a non-standard position => do a broader search in frontmatter -->
<xsl:variable name="isbn" select="(//level1//text()[matches(.,'^.*?ISBN[:\s]*([\d\- ]+)([^\d\- ]|$).*?$')]/replace(replace(.,'^(|.*?\s*)ISBN[:\s]*([\d\- ]+)([^\d\- ].*?$|$)','$2'),'[^\d]',''))[1]"/>

I will rewrite it in a less resource-intensive way and see if that helps.