2011-06-10 49 views
1

我想遍歷XML文檔中的所有cd元素。如何在Biztalk中使用迭代?

<?xml version="1.0" encoding="iso-8859-1"?> 
<ns0:catalog xmlns:ns0="http://Catalog.MP"> 
    <cd> 
     <title>Empire Burlesque</title> 
     <artist>Bob Dylan</artist> 
     <country>USA</country> 
     <company>Columbia</company> 
     <price>10.90</price> 
     <year>1985</year> 
    </cd> 
    <cd> 
     <title>Hide your heart</title> 
     <artist>Bonnie Tyler</artist> 
     <country>UK</country> 
     <company>CBS Records</company> 
     <price>9.90</price> 
     <year>1988</year> 
    </cd> 
    <cd> 
     <title>Greatest Hits</title> 
     <artist>Dolly Parton</artist> 
     <country>USA</country> 
     <company>RCA</company> 
     <price>9.90</price> 
     <year>1982</year> 
    </cd> 
    <cd> 

在XSLT我會做這樣的事情,並使用foreach循環:

<xsl:output method="html" indent="yes"/> 

    <xsl:template match="/ns0:catalog"> 

    <div class="catalog"> 
     <xsl:for-each select="cd"> 
      <div class="cd"> 
       <div class="title"> 
        <xsl:value-of select="title/text()" /> 
       </div> 
       <div class="artist"> 
        <xsl:value-of select="artist/text()" /> 
       </div> 
       <div class="country"> 
        <xsl:value-of select="country/text()" /> 
       </div> 
       <div class="company"> 
        <xsl:value-of select="company/text()" /> 
       </div> 
       <div class="price"> 
        <xsl:value-of select="price/text()" /> 
       </div> 
       <div class="year"> 
        <xsl:value-of select="year/text()" /> 
       </div> 
      </div> 
     </xsl:for-each> 

但如何做到這一點的Biztalk的和使用等效的functoid?

+0

http://msdn.microsoft.com/en-us/library/ee253826%28v=bts.10%29.aspx - 這更有幫助! – marko 2011-06-10 15:09:37

回答