[DDI-users] XSLT: How to iterate over contained var's or varGrp's

Andrew L Arnott relate_webmaster at byu.edu
Wed Aug 11 14:21:13 EDT 2004


Quick question on XSLT:

If I have a varGrp with 5 var's referenced in it,
<varGrp ID="VG1" var="V1 V2 V3 V4 V5"/>

And of course the necessary variables also in the XML, then how do I iterate
over those variables in XSLT?  I have used EXSLT to tokenize the string and
then do a search like this:
<xsl:variable name="IDlist"
select="ExsltStrings:tokenize(/codeBook/dataDscr/varGrp[@ID='VG1']"/>
<xsl:variable name="varList" select="/codeBook/dataDscr/var[@ID=$IDlist]"/>
<xsl:for-each select="varList">
	...
</xsl:for-each>

But I want to get away from using extension methods.  It seems like
something this common would be provided for in XSLT, maybe using xsl:key or
something like that.  But I just don't know it. Can someone please advise?

Thanks,
Andrew
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3230 bytes
Desc: not available
Url : http://lion.icpsr.umich.edu/pipermail/ddi-users/attachments/20040811/68ffcf8e/smime.bin


More information about the DDI-users mailing list