We're trying what should be a simple thing, wrapping every 2 items with a DIV tag. I found a good example here:
http://stackoverflow.com/questions/5604726/xslt-how-can-i-wrap-each-3-elements-by-div
(See the second answer, it's more elegant.)
And I was able to implement this, almost to perfection. The one problem I am having is my targeting of "match='/'". When target that broadly, it returns the Data elements and the Field elements. When I use the following, it returns nothing. How can I adjust my queries to get just the data I need?
01.
<
xsl:variable
name
=
"group"
select
=
"2"
/>
02.
<
xsl:template
match
=
"udt:UserDefinedTable"
>
03.
<
xsl:apply-templates
04.
select
=
"udt:UserDefinedTable/Data[position() mod $group = 1]"
/>
05.
</
xsl:template
>
06.
07.
<
xsl:template
match
=
"udt:Data"
mode
=
"inner"
>
08.
<
section
class
=
"column"
>
09.
<
a
href
=
"link"
class
=
"mastermind-group"
>
10.
<
h2
>
11.
<
xsl:value-of
select
=
"udt:Headline"
disable-output-escaping
=
"yes"
/>:
12.
</
h2
>
13.
<
p
>
14.
<
strong
>
15.
<
xsl:value-of
select
=
"udt:Subhead"
disable-output-escaping
=
"yes"
/>
16.
</
strong
>
17.
</
p
>
18.
<
img
alt
=
""
src
=
"/portals/quantumclub/images/qc-mastermind-group.png"
width
=
"183"
height
=
"161"
class
=
"right"
/>
19.
<
p
>
20.
<
xsl:value-of
select
=
"udt:Body"
disable-output-escaping
=
"yes"
/>
21.
<
span
class
=
"more"
>Learn more</
span
>
22.
</
p
>
23.
</
a
>
24.
</
section
>
25.
</
xsl:template
>
26.
27.
<
xsl:template
match
=
"udt:Data"
>
28.
<
xsl:variable
name
=
"currentData"
select
=
".|following-sibling::udt:Data[position() < $group]"
/>
29.
<
div
class
=
"grid2col"
>
30.
<
xsl:apply-templates
31.
select
=
"$currentData"
32.
mode
=
"inner"
/>
33.
</
div
>
34.
</
xsl:template
>
This is just the key portion of the XSL. (Removed the standard headers and edit link for brevity.)
Thanks for your input