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

Flagging records that don't match a particular pattern

Subject: Flagging records that don't match a particular pattern
From: "Grant Slade" <grant.slade@xxxxxxxxx>
Date: Mon, 19 Mar 2007 19:06:31 -0600
 Flagging records that don't match a particular pattern
Hello - I am relatively new to xslt.  I was wondering how to flag
records that don't match a pattern.  I am going to be iterating
through about 8000 xml files in java transforming them from one xml to
another format required by a different company.  I know that I am
going to miss some of the patterns at first but was wondering if
there's a way to flag the files that don't match up and maybe write
them to a seperate directory.

For example in matching author tags (<AU>Slade, Grant^Riggins,
John</Au>) - could I do something in the xsl:otherwise part?:
  <xsl:template match="AU">
       <contrib contrib-type="author">
           <xsl:choose>
               <xsl:when test="contains(., '^')">
                   <xsl:for-each select="tokenize(.,'\^')">
                       <xsl:choose>
                           <xsl:when test="contains(.,',')">
                               <name>
                                   <surname>
                                       <xsl:value-of
select="substring-before(.,',')"/>
                                   </surname>
                                   <given-names>
                                       <xsl:value-of
select="substring-after(.,',')"/>
                                   </given-names>
                               </name>
                           </xsl:when>
                       </xsl:choose>
                   </xsl:for-each>
               </xsl:when>
               <xsl:otherwise>OUTPUT TO DIFFERENT DIRECTORY
HERE?</xsl:otherwise>
           </xsl:choose>
       </contrib>
   </xsl:template>

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.