[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"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl"
    xmlns:ifc="http://www.iai-tech.org/ifcXML/IFC2x3/FINAL"
    exclude-result-prefixes="xs xd"
    version="2.0">
    <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"/>
            </xsl:if>
        </xsl:for-each>
    </xsl:template>
</xsl:stylesheet>
It would be great if someone could point out to me either the incorrect syntax or the absence of the correct configuration.
Kind Regards
Lewis
[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.
http://www.gcu.ac.uk/newsevents/news/bycategory/theuniversity/1/name,6219,en.html
Winner: Times Higher Education’s Outstanding Support for Early Career Researchers of the Year 2010, GCU as a lead with Universities Scotland partners.
http://www.gcu.ac.uk/newsevents/news/bycategory/theuniversity/1/name,15691,en.html
    
    
More information about the oXygen-user
mailing list