I have to use xslt 1.0 and I have following xml:
<Root>
<Alarm>
<Name>short</Name>
<FlagValues>Client, RunTime, Language</FlagValues>
</Alarm>
<Alarm>
<Name>long</Name>
<FlagValues>Client, Formatted, RunTime, Language</FlagValues>
</Alarm>
</Root>
At the beginning of my xslt transformation I want to create a mapping with xsl:key..... I need all "Alarm"-nodes where the string "Formatted" is in the "FlagValues"-node. The Key should be the "Name".
So here is my try:
<xsl:key name="alarmNodes" match="Root/Alarm/FlagValues[contains(text(), 'Formatted')]" use="Name" />
But when I try to access it, it is empty:
<xsl:when test="key('alarmNodes', "'long'")">
My expected result is a node-Object containing this:
<Alarm>
<Name>long</Name>
<FlagValues>Client, Formatted, RunTime, Language</FlagValues>
</Alarm>
Any ideas whats going wrong?
Thanks Marcus
You're selecting
FlagValuesin your match (andFlagValuesdoesn't have a childName).Try selecting
Alarminstead...You also have quoting issues in the
testof yourxsl:when, but you'd be getting an exception so that's probably just a typo.