T
Terry Chilvers
In XSLT I want to select elements and output the value of a particular
attribute. However I don't want to process the element if it doesn't contain
this attribute. I'm using this to generate some code from an xsd i.e. I'm
traeting the xsd as a source xml file.
e.g.
<xs:element name="prompt" substitutionGroup="tech.char.class">
<xs:complexType mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:group ref="smallcptr.char.mix"/>
<xs:element ref="co"/>
</xs:choice>
<xs:attributeGroup ref="moreinfo.attrib"/>
<xs:attributeGroup ref="common.attrib"/>
<xs:attributeGroup ref="prompt.role.attrib"/>
</xs:complexType>
</xs:element>
Here I want to output a line if the attribute "substitutionGroup" exists,
and nothing if it doesn't.
I've looked for examples, but no joy. Any ideas please?
Here's a snippet from the xslt:
<xsl:for-each select="//xs:element">
element: <xsl:value-of select="@name"/>
SubstGroup: <xsl:value-of select="@substitutionGroup"/>
but it always outputs a "SubstGroup:" line for every element.
Thanks
Terry
attribute. However I don't want to process the element if it doesn't contain
this attribute. I'm using this to generate some code from an xsd i.e. I'm
traeting the xsd as a source xml file.
e.g.
<xs:element name="prompt" substitutionGroup="tech.char.class">
<xs:complexType mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:group ref="smallcptr.char.mix"/>
<xs:element ref="co"/>
</xs:choice>
<xs:attributeGroup ref="moreinfo.attrib"/>
<xs:attributeGroup ref="common.attrib"/>
<xs:attributeGroup ref="prompt.role.attrib"/>
</xs:complexType>
</xs:element>
Here I want to output a line if the attribute "substitutionGroup" exists,
and nothing if it doesn't.
I've looked for examples, but no joy. Any ideas please?
Here's a snippet from the xslt:
<xsl:for-each select="//xs:element">
element: <xsl:value-of select="@name"/>
SubstGroup: <xsl:value-of select="@substitutionGroup"/>
but it always outputs a "SubstGroup:" line for every element.
Thanks
Terry