Reputation: 179
I am having an xml file that goes like this.
<RootTag>
<Form>
<Section>
<Annex>
<Group>
<Label value = "Name"></Label>
<Text Value = "Enter Name"></Text>
</Group>
<Group>
<Label value = "Gender"></Label>
<Radio Value = "Male||Female"></Text>
</Group>
</Annex>
</Section>
</Form>
</RootTag>
Now in my xsl, I have to check if the tag is <Text>
or <Radio>
and generate <input>
tag based on that result.
Is there any whay I can do it using <xsl:if>
? Like <xsl:if test = 'node = <Text>'>
Upvotes: 13
Views: 27714
Reputation:
<xsl:if test="name() = 'Form'">
However, there are other approaches which may be better:
One is to use a template for this item; the XSLT engine will automatically perform the test, if you want to look at it that way.
<xsl:template match="Form">
Another is to use the self::
axis
<xsl:for-each select="self::Form">
Upvotes: 25