Having problems creating a xsl:when condition
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 2
- Joined: Thu Mar 30, 2006 6:51 pm
Having problems creating a xsl:when condition
What I am trying to accomplish is determine that the copiedItemRecKey is not empty and also determine whether the value in copiedItemRecKey exists in any other items by checking the value in the primaryKey of all the other items. If the node count is greater than zero then one of the items has the same key as the copiedItemRecKey.
The context when this is called is /SendRfqDto/scenariosToBeShopped/SpecialInquiryScenarioDto/itemDtos/SpecialItemDto/specialItem
<xsl:when test="(not(normalize-space(copiedItemRecKey) = '')) and (count(/SendRfqDto/scenariosToBeShopped//SpecialInquiryScenarioDto/itemDtos/SpecialItemDto/specialItem[primaryKey] = copiedItemRecKey) > 0)">
do something...
</xsl:when>
It is not working however...obviously I'm new to xsl and could be doing this completely wrong without knowing it.
Oxygen reports when I run the transform:
SystemID: /Users/mjarrett/Desktop/PreviewSpecialInquiryRFQ-new.xsl
Location: 465:0
Description: Can not convert #BOOLEAN to a NodeList!
Does anyone have any suggestions to accomplish what I'm trying to do?
The context when this is called is /SendRfqDto/scenariosToBeShopped/SpecialInquiryScenarioDto/itemDtos/SpecialItemDto/specialItem
<xsl:when test="(not(normalize-space(copiedItemRecKey) = '')) and (count(/SendRfqDto/scenariosToBeShopped//SpecialInquiryScenarioDto/itemDtos/SpecialItemDto/specialItem[primaryKey] = copiedItemRecKey) > 0)">
do something...
</xsl:when>
It is not working however...obviously I'm new to xsl and could be doing this completely wrong without knowing it.
Oxygen reports when I run the transform:
SystemID: /Users/mjarrett/Desktop/PreviewSpecialInquiryRFQ-new.xsl
Location: 465:0
Description: Can not convert #BOOLEAN to a NodeList!
Does anyone have any suggestions to accomplish what I'm trying to do?
-
- Posts: 2
- Joined: Thu Mar 30, 2006 6:51 pm
Please ignore the error message.
Please ignore the error message. I probably shouldn't have put it in the original post. I have gotten at least a dozen different errors while trying out different combinations of xpath expressions.
What I am really wanting is someone to tell me if what I am trying to do is impossible using XSL. One of the people I talked to here at work said he didn't think XSL could be used for this level of evaluation and I should be doing everything in Java. Is he right?
I'll be happy to post more info if it is needed. I'd hate to give up at this point when I'm so close to finishing. This is the only evaluation which isn't working the way I need it to.
Thanks in advance.
What I am really wanting is someone to tell me if what I am trying to do is impossible using XSL. One of the people I talked to here at work said he didn't think XSL could be used for this level of evaluation and I should be doing everything in Java. Is he right?
I'll be happy to post more info if it is needed. I'd hate to give up at this point when I'm so close to finishing. This is the only evaluation which isn't working the way I need it to.
Thanks in advance.
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
-
- Posts: 89
- Joined: Mon Mar 06, 2006 10:13 pm
Entire condition should be in the brackets..
otherwise you're only taking one node, comparing to copiedItemRecKey, and then trying to count if it matched or not.
moved the ']'
<xsl:when test="(not(normalize-space(copiedItemRecKey) = '')) and (count(/SendRfqDto/scenariosToBeShopped//SpecialInquiryScenarioDto/itemDtos/SpecialItemDto/specialItem[primaryKey = copiedItemRecKey]) > 0)">
otherwise you're only taking one node, comparing to copiedItemRecKey, and then trying to count if it matched or not.
moved the ']'
<xsl:when test="(not(normalize-space(copiedItemRecKey) = '')) and (count(/SendRfqDto/scenariosToBeShopped//SpecialInquiryScenarioDto/itemDtos/SpecialItemDto/specialItem[primaryKey = copiedItemRecKey]) > 0)">
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service