I have been investigating using xsl:message to try and capture
problems in my stylesheet. I find that it does send a message to the
processor, but I'm unsure how to capture that message within the Java
application. Is that possible?
On 3/20/07, Michael Kay <mike(_at_)saxonica(_dot_)com> wrote:
Since you are using XSLT 2.0 you could use xsl:result-document to create an
output file to hold the validation messages. Alternatively you might be able
to use xsl:message, by directing the xsl:message output to a suitable
destination.
Michael Kay
http://www.saxonica.com/
> -----Original Message-----
> From: Grant Slade [mailto:grant(_dot_)slade(_at_)gmail(_dot_)com]
> Sent: 20 March 2007 01:07
> To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
> Subject: [xsl] 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>
>
> --~------------------------------------------------------------------
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
> To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
> or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
> --~--
>
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--