Subject:SpreadsheetML matching same cell with multiple names Author:Justin Kohlhepp Date:16 Apr 2007 10:22 AM
I am working on an XSLT to take an Excel XML (a.k.a. SpreadsheetML) template and insert data into it. Sections in the template are identified by many different name regions. In SpreadsheetML, when you give a cell or region a name, it translates to the following:
Initially, I had in my template just something along the lines of <xsl:template match="Cell[NamedCell[@Name='x']]"> to find a given cell by name. However, I'm realizing that I may need to match the *same cell* for different names and do different things to the cell. In some cases, I would need both <xsl:template match="Cell[NamedCell[@Name='x']]"> and <xsl:template match="Cell[NamedCell[@Name='y']]"> to match. But my understanding of XSLT is that each node (i.e. Cell in this case) will only match one template.
Then inside the template, refer to the parent elements using the parent axis. Easiest transition would just be to surround the current contents of the template with:
<xsl:for-each select="..">