[oXygen-user] Syntax problem with xslt 'contains' text()

McGibbney, Lewis John Lewis.McGibbney at gcu.ac.uk
Tue Jun 12 12:44:58 CDT 2012

Good Afternoon Everyone,

I have a large schema file [0].
I wish to grab a subset of the <xs:element>'s within the XSD and print them to a significantly smaller and more manageable/relevant output file.

In particular I wish to grab every occurrence of an <xs:element> where the substitutionGroup value is equal to "ifc:IfcBuildingElement"

I've been using the following xsl code and it is not working.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    exclude-result-prefixes="xs xd"
    <xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
    <xsl:strip-space elements="*"/>

    <xsl:template name="main" match="/">
        <xsl:for-each select="xs:schema/xs:element">
            <xsl:if test="@substitutionGroup[contains(text(), ifc:IfcBuildingElement)]">
                    <xsl:value-of select="xs:schema/xs:element"/>


It would be great if someone could point out to me either the incorrect syntax or the absence of the correct configuration.

Kind Regards


[0] http://www.buildingsmart-tech.org/ifcXML/IFC2x3/FINAL/IFC2X3.xsd

Glasgow Caledonian University is a registered Scottish charity, number SC021474

Winner: Times Higher Education’s Widening Participation Initiative of the Year 2009 and Herald Society’s Education Initiative of the Year 2009.

Winner: Times Higher Education’s Outstanding Support for Early Career Researchers of the Year 2010, GCU as a lead with Universities Scotland partners.

More information about the oXygen-user mailing list