[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: Jim_Albright@xxxxxxxxxxxx
Date: Sat, 20 Sep 2003 09:27:33 -0400
analyze string regex group
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


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.