In the database, the user has created a number of properties depending on his needs. An XML generated on the server-side includes all the properties from the database and the data they hold. The report generated, by Microsoft's XSLT processor, includes a sub-set of these properties based on the user's selections (via a list of checkboxes in the UI).
<xml ...>
<property id="01" title="First Property" value="Beauty of XSLT"/>
<property id="02" title="Second Property" value="Please Help"/>
<property id="XX" title="Variable Number" value="Use Global Variables"/>
</xml>
Previously, I had a fixed number of properties which had pre-defined names. I used global variables in the XSL file and passed their values (on or off) to the XSLT processor. Now, both of these, the name of the properties and their number, are user defined.
Somehow, I need to pass the list of properties to show to the XSLT processor. I am not sure how. Any suggestion or guidance is appreciated.
EDIT -- adding clarification:
The XML, generated on the server-side, includes all properties regardless of the user selection. The transformation is done on the client-side based on the user selection of what properties to display. The user may change this selection however we do NOT re-generate the XML. We simply pass different values to the XSLT processor, as global variables. When these properties are fixed, the global variables look like this: g_property_id-01
and it's set to true
, display, or false
, do not display. Now, I don't know the number/names of the user-created properties; hence my problem.
EDIT -- adding XSLT as requested:
<?xml version="1.0"?>
<xsl:stylesheet ...>
...
<!-- This XSL Template is used to transform report results into HTML. -->
<xsl:param name="g_bShow_Property01" select="1"/>
<xsl:param name="g_bShowUser" select="1"/>
...
<xsl:template match="Result">
<xsl:variable name="g_bShowHeader" select="$g_bShowUser=1 or $g_bShow_Property01=1"/>
...
<!-- Should we show the Property with 01 id? -->
<xsl:if test="$g_bShow_Property01 = 1 and ./Document/Property02Value">
<xsl:variable name="FixedUpProperty">
<xsl:call-template name="fixup-text">
<xsl:with-param name="fixup-string" select="./Document/Property02Value"/>
</xsl:call-template>
</xsl:variable>
</xsl:if>
</xsl:stylesheet>