GessWurker
asked on
How to construct condition in xsl
I need to modify the attached XSL so that it returns information for fields that are empty in the input.
I.E. If the input contains
<inmr0:CatNotes />,
I need the XSL to return
<PropertyValue name="Notes" />
rather than nothing.
To clarify: I don't know how to set up conditions in the XSL so that it doesn't completely ignore the the empty fields in input.
I've attached the XSL along with sample input. The input contains a number of empty fields, including these:
<inmr0:CatNotes />
<inmr0:CatISBN />
<inmr0:CatFileName />
However, as I said, such fields make NO APPEARANCE in the output. What I need to see for them is this:
<PropertyValue name="Notes" />
<PropertyValue name="ISBN" / >
<PropertyValue name="Document File Name" / >
Who knows how to do this?
NeedsAdjustment.xsl
inputTEST.xml
inputTEST-out-problem.xml
I.E. If the input contains
<inmr0:CatNotes />,
I need the XSL to return
<PropertyValue name="Notes" />
rather than nothing.
To clarify: I don't know how to set up conditions in the XSL so that it doesn't completely ignore the the empty fields in input.
I've attached the XSL along with sample input. The input contains a number of empty fields, including these:
<inmr0:CatNotes />
<inmr0:CatISBN />
<inmr0:CatFileName />
However, as I said, such fields make NO APPEARANCE in the output. What I need to see for them is this:
<PropertyValue name="Notes" />
<PropertyValue name="ISBN" / >
<PropertyValue name="Document File Name" / >
Who knows how to do this?
NeedsAdjustment.xsl
inputTEST.xml
inputTEST-out-problem.xml
ASKER
Hi. And thanks. Nearly there. However... there's one problem: The concatentation for Document File Name. With an empty CatFileName, I end up with this:
<PropertyValue name="Document File Name">F:\Program Files\Inmagic\Genie\Docume ntFolder\< /PropertyV alue>
I need to end up with this:
<PropertyValue name="Document File Name" />
<PropertyValue name="Document File Name">F:\Program Files\Inmagic\Genie\Docume
I need to end up with this:
<PropertyValue name="Document File Name" />
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks. Works as advertised! (i.e., perfectly!)
Cheers!
Cheers!
welcome
<xsl:for-each select="inmr0:CatNotes[str
does something for every CatNotes that ahs content
[string(.)] actually excludes all the notes that don't have content
if you remove all the occurences of [string(.)] from your stylesheet it will do what you need