[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE:creating canonRef from flat
Thank you to David, Jim, and Michael Here is working code I am looking forward to adding select on an attribute. That makes the code much nicer. The lookup table is great! Really is elegant. Thanks again for all your help on the list. <xsl:template match="r"> <xsl:element name="parallelPassage"> <xsl:analyze-string select="." regex="[^;]+"> <xsl:matching-substring> <xsl:element name="canonRef"> <xsl:analyze-string select="." regex="([^\s]+)\s([0-9]+)\.([0-9]+)\-([0-9]+)"> <xsl:matching-substring> <xsl:attribute name="book"> <xsl:value-of select="my:abbrev(regex-group(1))"/> </xsl:attribute> <xsl:attribute name="chapter"> <xsl:value-of select="regex-group(2)"/> </xsl:attribute> <xsl:attribute name="verse"> <xsl:value-of select="regex-group(3)"/> </xsl:attribute> <xsl:if test="regex-group(4)"> <xsl:attribute name="verseEnd"> <xsl:value-of select="regex-group(4)"/> </xsl:attribute> </xsl:if> </xsl:matching-substring> </xsl:analyze-string> </xsl:element> </xsl:matching-substring> </xsl:analyze-string> </xsl:element> </xsl:template> <xsl:function name="my:abbrev"> <xsl:param name="long-name"/> <xsl:variable name="table"> <book long="Mateus" short="MAT"/> <book long="Marcos" short="MRK"/> <book long="Lucas" short="LUK"/> <book long="João" short="JHN"/> </xsl:variable> <xsl:sequence select="$table/book[@long=$long-name]/@short"/> </xsl:function> Jim Albright 704 843-0582 Wycliffe Bible Translators 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
|