473,326 Members | 2,805 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Complex XPath expression

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
1 1282
> 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: inquirydog | last post by:
Hi- One frusterating thing for me with xsl is that I don't know how to make xslt throw some sort of exception when a value-of path does not exist. For instance, suppose I have the following...
3
by: gimme_this_gimme_that | last post by:
I once downloaded a shareware program that allowed you to open an xml file, click on a text or an attribute, an then see the xpath expression that would fetch that data. The program didn't...
7
by: steve bull | last post by:
I have the following code snippet to read the colorRange attributes for the colorRangeSwatch in the xml file listed below. string expr = "/swatches/colorRangeSwatch/colorRange";...
2
by: ree32 | last post by:
When I import an xml document in Visual studio and Genereate as schema from it, and create a dataset from it, it adds this line into to the root element of my xml file -...
5
by: laks | last post by:
Hi I have the following xsl stmt. <xsl:for-each select="JOB_POSTINGS/JOB_POSTING \"> <xsl:sort select="JOB_TITLE" order="ascending"/> This works fine when I use it. But when using multiple...
5
by: David Thielen | last post by:
Hi; I set up my xml as follows: XmlDocument xml = new XmlDocument(); xml.Load(File.Open("data.xml", FileMode.Open, FileAccess.Read)); XmlNamespaceManager context = new...
6
by: Chua Wen Ching | last post by:
Hi there, I had this xml file with me (not yet consider implementing xml namespaces yet). <?xml version='1.0'?> <Object> <Windows> <EID>1</EID> <EDesc>Error 1</EDesc> </Windows>
4
by: syed.akhlaq | last post by:
Hi, Does anyone know how can I validate XPath expressions using xsd schema? Thanks
2
by: arunairs | last post by:
Hi, Is there a way of validating and XPath? In this case , I am accepting an XPath from the user and I need to validate the XPath syntax. Is there a regular expression available that anyone can...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.