|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
test for the existance of an element
HI All,
Using the DOM (not an XSLT document). how do I test for the existance of an Element? I have: <Body> <Agent>xzt</Agent> more elements ..... ....... </Body> Where say Agent may or may not exist. If Agent exist's then I want to do one thing otherwise I want to do another. |
|
#2
|
|||
|
|||
|
Just do a test on the element name. So assuming your context node is the parent of agent, you would do something like the following:
<xsl:choose> <xsl:when test="agent"> do stuff if agent is present </xsl:when> <xsl therwise>do other stuff </xsl therwise></xsl:choose> Cul |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > test for the existance of an element |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|