xsl:for-each not supported in this context

Posted by alexbf on Stack Overflow See other posts from Stack Overflow or by alexbf
Published on 2010-05-31T15:47:16Z Indexed on 2010/05/31 15:53 UTC
Read the original article Hit count: 236

Filed under:
|

Hi!

I have this XSLT document :

<xsl:stylesheet version="1.0" xmlns:mstns="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/MyDocRootElement">
    <xs:schema id="DataSet" targetNamespace="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified" elementFormDefault="qualified" >
        <xs:element name="DataSet" msdata:IsDataSet="true">
            <xs:complexType>
                <xs:choice maxOccurs="unbounded">
                    <xs:element name="Somename"> </xs:element>
                    <xs:element name="OtherName">

                    </xs:element>
                    <!-- FOR EACH NOT SUPPORTED? -->
                    <xsl:for-each select="OtherElements/SubElement">
                             <xs:element name="OtherName">

                            </xs:element>
                    </xsl:for-each>
                </xs:choice>
            </xs:complexType>
        </xs:element>
    </xs:schema>
</xsl:template>
</xsl:stylesheet>

I have a validation error saying that the "for-each element is not supported in this context"

I am guessing it has something to do with the xs namespace validation.

Any ideas on how can I make this work? (Exclude validation?)

Thanks Alex

© Stack Overflow or respective owner

Related posts about Xml

Related posts about xslt