By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,962 Members | 1,776 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,962 IT Pros & Developers. It's quick & easy.

Complex XPath expression

P: n/a
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
Mar 17 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
> Unfortunately I can not get an input XML [Cocoon pipelines sometimes are
very difficult to debug,
inserting serializer doesn't produce anything]


Suggestion: Try an identity transform to get a copy of what the input
stream looks like, and use that for debugging (or at least show it to us
so we can help you debug).

I don't know whether the Cocoon SQLTransformer is related to the Xalan
SQL extension. If it is, you may find that there are constraints on what
kinds of stylesheets will work with it.
--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Mar 17 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.