[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|