The following isn't working as intended:
<xsl:template match="xs:complexType">
<xsl:param name="prefix" />
<xsl:if test="$prefix='core'">
<xsl:variable name="prefix" select=""/>
</xsl:if>
<xs:complexType name="{concat($prefix, @name)}">
<xsl:apply-templates select="node()" />
</xs:complexType>
<xsl:apply-templates select=".//xs:element" />
</xsl:template>
The idea is that if the prefix variable value is "core", I don't want it to be added onto the name attribute value. Any other value, I'd like to be added. IE:
<xs:complexType name="coreBirthType">
...is not acceptable, while the following would be:
<xs:complexType name="BirthType">
But I have to allow for this to occur:
<xs:complexType name="AcRecHighSchoolType">
I tried this in a block, but saxon complains about not finding a closing node:
<xsl:choose>
<xsl:when test="starts-with(.,'core')">
<xs:complexType name="{@name)}">
</xsl:when>
<xsl:otherwise>
<xs:complexType name="{concat($prefix, @name)}">
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="node()" />
</xs:complexType>
What is the best way to handle this?