W
William Krick
I am writing an XSL transform that converts XML data about vehicles
into XML data that will fill printed forms.
The default form can handle up to 5 vehicles which I handle using
subscripts...
<xsl:for-each select="VEHICLE[1]">
<!-- spit out some stuff about this vehicle -->
</xsl:for-each>
<xsl:for-each select="VEHICLE[2]">
<!-- spit out some stuff about this vehicle -->
</xsl:for-each>
<xsl:for-each select="VEHICLE[3]">
<!-- spit out some stuff about this vehicle -->
</xsl:for-each>
<xsl:for-each select="VEHICLE[4]">
<!-- spit out some stuff about this vehicle -->
</xsl:for-each>
<xsl:for-each select="VEHICLE[5]">
<!-- spit out some stuff about this vehicle -->
</xsl:for-each>
Then, if there are more than 5 vehicles, I need to output them, 5 at a
time, onto one or more "extension" forms as needed. Note that the
extra vehicles will not always be in multiples of 5.
I'm at a loss as to how to handle this in a generic way without
hardcoding conditional forms for every multiple of 5 up to some
arbitrary maximum.
I'm thinking that to handle it generically, I'd need to do something
tricky with math in the subscripts possibly using the mod operator but
I'm not sure if that's even possible.
Has anyone dealt with a similar problem?
I can post more detailed examples if my description isn't clear. Just
ask.
into XML data that will fill printed forms.
The default form can handle up to 5 vehicles which I handle using
subscripts...
<xsl:for-each select="VEHICLE[1]">
<!-- spit out some stuff about this vehicle -->
</xsl:for-each>
<xsl:for-each select="VEHICLE[2]">
<!-- spit out some stuff about this vehicle -->
</xsl:for-each>
<xsl:for-each select="VEHICLE[3]">
<!-- spit out some stuff about this vehicle -->
</xsl:for-each>
<xsl:for-each select="VEHICLE[4]">
<!-- spit out some stuff about this vehicle -->
</xsl:for-each>
<xsl:for-each select="VEHICLE[5]">
<!-- spit out some stuff about this vehicle -->
</xsl:for-each>
Then, if there are more than 5 vehicles, I need to output them, 5 at a
time, onto one or more "extension" forms as needed. Note that the
extra vehicles will not always be in multiples of 5.
I'm at a loss as to how to handle this in a generic way without
hardcoding conditional forms for every multiple of 5 up to some
arbitrary maximum.
I'm thinking that to handle it generically, I'd need to do something
tricky with math in the subscripts possibly using the mod operator but
I'm not sure if that's even possible.
Has anyone dealt with a similar problem?
I can post more detailed examples if my description isn't clear. Just
ask.