How to rendering tricky XML schema

My XML document is as follows:

      <DataSet>
      <xs:schema id="NewDataSet">
      <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:Locale="sv-SE">
      <xs:complexType>
      <xs:choice maxOccurs="unbounded">
      <xs:element name="Table">
      <xs:complexType>
      <xs:sequence>
<xs:element name="Origin" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
      <diffgr:diffgram>
      <NewDataSet>
      <Table diffgr:id="Table1" msdata:rowOrder="0">
<Origin>Göteborg/Landvetter GOT</Origin>
</Table>
      <Table diffgr:id="Table2" msdata:rowOrder="1">
<Origin>Helsingborg/Ängelholm AGH</Origin>
</Table>
      <Table diffgr:id="Table3" msdata:rowOrder="2">
<Origin>Helsinki/Vantaa HEL</Origin>
</Table>
      <Table diffgr:id="Table4" msdata:rowOrder="3">
<Origin>Malmö/Sturup MMX</Origin>
</Table>
      <Table diffgr:id="Table5" msdata:rowOrder="4">
<Origin>Stockholm/Arlanda ARN</Origin>
</Table>
</NewDataSet>
</diffgr:diffgram>
</DataSet>


What I would like is a piece of XSL that loops through the list of tags called "<Origin>".

Thanks in advance.
ribbegrdAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DitmarBehnCommented:
Hi ribbegrd,
this should do the trick (note that there are three different ways within the following XLS)
Ditmar


<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:diffgr='mydiffgr' >
<!--
***********************************************************************
*** Author:    Ditmar Behn
*** Date:      2004-11-01
*** Origin:    www.experts-exchange.com
***********************************************************************
-->

  <!-- Start the pattern matching mechanism in the root element -->
  <xsl:template match="/">
    <root>
      <!-- Either find all occurances of 'Origin' anywhere -->
      <xsl:for-each select="//Origin">
        <xsl:value-of select="text()" />
      </xsl:for-each>

      <!-- or state explicitly the nodetree location -->
      <xsl:for-each select="DataSet/diffgr:diffgram/NewDataSet/Table/Origin">
        <xsl:value-of select="text()" />
      </xsl:for-each>

    </root>
  </xsl:template>


  <!-- or use pattern matching (document order) to be called by xsl:apply-template -->
  <xsl:template match="Origin">
    <xsl:value-of select="text()" />
  </xsl:template>


</xsl:stylesheet>
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.