Reputation:
I have a problem I couldn't solve despite extensive searching... This is a part from an XML.
<contributors>
<authors>
<author>Willett, C G</author>
<author>Tepper, J E</author>
<author>Kaufman, D S</author>
<author>Shellito, P C</author>
<author>Eliseo, R</author>
<author>Convery, K</author>
<author>Wood, W C</author>
</authors>
</contributors>
I tried to import all authors into a Filemaker cell by using this xsl (excerpt)
<FIELD EMPTYOK="YES" MAXREPEAT="15" NAME="Author" TYPE="TEXT"/>
<COL>
<DATA>
<xsl:for-each select="contributors/authors">
<xsl:value-of select="author">
</xsl:value-of>
</xsl:for-each>
</DATA>
</COL>
Unfortunately only the first name is imported. Why? What's missing?
Would be glad if someone could help me...
Cheers
Upvotes: 0
Views: 890
Reputation: 122394
<FIELD EMPTYOK="YES" MAXREPEAT="15" NAME="Author" TYPE="TEXT"/>
<COL>
<DATA>
<xsl:for-each select="contributors/authors/author">
<xsl:value-of select="."/>
<xsl:if test="position() < last()">; </xsl:if>
</xsl:for-each>
</DATA>
</COL>
This would produce a semicolon-separated list of all the author values. The <xsl:if>
is there to avoid adding a trailing semicolon after the last author name.
Upvotes: 0
Reputation: 101738
You need to iterate through the author
s, not through authors
, because there's only one authors
, but many author
s:
<xsl:for-each select="contributors/authors/author">
<xsl:value-of select="concat(., ' ')" />
</xsl:for-each>
Upvotes: 3