Xomega provides you an ability to analyze the model using the standard Visual Studio means, so that when changing one part of the model, you can review which other parts might be affected. If you have defined your own model elements, e.g. by
extending the Xomega model via additional configurations, that reference existing model entities, then you can easily include your elements in the Find References results the user gets when searching for everything that references those model entities using the Find References menu option.
The Find References behavior is driven by a dedicated XSL style sheet
symbol_browsing.xsl, which comes with the Xomega.Net and is located with other style sheets in the XSL folder of the Xomega installation. Remember, that this style sheet is using the XSLT 1.0, since it is run by the internal XSLT engine built in .Net, and therefore is fairly limited as compared to the XSL scripts used by the generators, which use XSLT 2.0.
The following steps outline the process for including your elements into the find references results. Note, that this process requires that you install the Full Edition of Xomega.Net and obtain the source code for the Xomega symbol browsing style sheet.
- Request the source code for symbol_browsing.xsl from Xomega, and place it to the XSL sub-folder of the Xomega.Net installation folder.
- Open the symbol_browsing.xsl file and find the template that matches the node for the entity being referenced and has a mode attribute set to refs.
- Inside that template, add an xsl:for-each loop that iterates over the elements that reference the entity. If you want to group the references, e.g. by the object they are defined in, you can iterate over those groups instead.
- For each item add a new node using the lib:AddNewNode($lstCls) function and store it in the idx variable.
- Set the list category to be member by calling the lib:SetCategory($idx, $catLst, $lstMbr) function.
- Set the name of the node by calling the lib:SetName function.
- Set the image of the node by calling the lib:SetImageKey function.
- If you're iterating over a group, call the lib:SetChildContext function and pass it to a list of nodes in the group that reference your entity.
- Test the Find References in your model to make sure that it works as expected.
The following example demonstrates the above steps.
Code:
<xsl:template match="o:fieldsets/o:fieldset | o:fieldsets/o:fieldset/@name" mode="refs">
<xsl:variable name="this" select="ancestor-or-self::o:fieldset[1]"/>
<xsl:for-each select="//o:object[o:fields/o:fieldset[@ref=$this/@name]]">
<xsl:variable name="idx" select="lib:AddNewNode($lstCls)"/>
<xsl:value-of select="lib:SetCategory($idx, $catLst, $lstMbr)"/>
<xsl:value-of select="lib:SetName($idx, @name)"/>
<xsl:value-of select="lib:SetImageKey($idx, 'VSObject_Class_Shortcut')"/>
<xsl:value-of select="lib:SetChildContext($idx, o:fields/o:fieldset[@ref=$this/@name]/@ref)"/>
</xsl:for-each>
</xsl:template>