[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: creating canonRef from flat

Subject: Re: creating canonRef from flat
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 19 Sep 2003 22:52:50 +0100
Re:  creating canonRef from flat
Oh sorry I didn't notice that you were changing the format of the book
names, Mike's posted a solution already but for the record here's my
version again with the lookup table for changing names stolen from
Mike's.

Both of our solutions assumed that the long book names don't include
spaces, as we're splitting on spaces to look for the chapter numbers.
If that isn't the case the regexp will need tweaking a bit.

The hardest part of getting this working was spelling regexp without a p
and analyse without an s...

David

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                 version="2.0">


<xsl:output indent="yes"/>

<xsl:variable name="books">
    <book long="Mateus" short="MAT"/>
    <book long="Lucas" short="LUK"/>
</xsl:variable>

<xsl:template match="r">
<parallelPassage>
<xsl:analyze-string  regex="[^;]+" select=".">
<xsl:matching-substring>
<xsl:analyze-string  regex="([A-Za-z]+)
*([0-9]+)\.([0-9]+)-([0-9]+)(.*$)" select=".">
<xsl:matching-substring>
<canonRef
Book="{$books/book[@long=regex-group(1)]/@short}"
chapter="{regex-group(2)}"
verse="{regex-group(3)}"
verseend="{regex-group(4)}"
/>
</xsl:matching-substring>
</xsl:analyze-string >
</xsl:matching-substring>
</xsl:analyze-string>
</parallelPassage>
</xsl:template>

</xsl:stylesheet>

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.