Hi,
I am trying to do an enhancement to Cocoon 2.0/XSLT1.0 application:
add a date validation of Excel cells (named Start_Date) in SQLTransformer,
so if a Type of that cell is not a DATE, insert that row into Error table
(otherwise to the Main table).
I tried:
<xsl:when test='not(sht:Cell[sht:Name="Start_Date"]/@ValueType = "DATE")' >
and:
<xsl:when test='not(sht:Cell/sht:Name[.="Start_Date"]/@ValueType = "DATE")'>
but neither worked (seems to stop - no exceptions).
Unfortunately I can not get an input XML [Cocoon pipelines sometimes are
very difficult to debug,
inserting serializer doesn't produce anything]
Here is a code snippet. It uploads Excel file, converts it to XML and
processes it.
<xsl:template match="/">
....<xsl:apply-templates/>
</xsl:template>
<xsl:template match='sht:Row'>
<!-- do some integrity checks. If they fail, put them into the
load_member_reject table -->
<xsl:choose>
<xsl:when
test='not(sht:Cell[sht:Name="Facility_Start_Date"]/@ValueType="DATE")'>
<xsl:call-template name='buildStatement'>
<xsl:with-param name='row' select='.'/>
<xsl:with-param
name='table'><xsl:text>load_member_reject</xsl:text></xsl:with-param>
<xsl:with-param name='notes'>
<xsl:text>Facility_Start_ Date has a wrong type or date is not
formatted properly (record ignored)</xsl:text>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
.... other validations
otherwise - insert in main_table
</xsl:choose>
</xsl:template>
I am new to XSLT/XPATH/Cocoon and have nobody else to ask.
Sorry for the newbie question.
Any help is very appreciated.
Thank you in advance,
Oleg.
ol*****@yahoo.com