Mercurial > hg > ooxml
diff refs.xsl @ 27:8309dcfce613
preparing for variable deref
author | Henry S. Thompson <ht@markup.co.uk> |
---|---|
date | Mon, 10 Apr 2017 17:29:24 +0100 |
parents | a5125a2e77ea |
children | c56a2e6990bd |
line wrap: on
line diff
--- a/refs.xsl Fri Apr 07 18:42:47 2017 +0100 +++ b/refs.xsl Mon Apr 10 17:29:24 2017 +0100 @@ -1,16 +1,22 @@ <?xml version='1.0'?> <!DOCTYPE doc SYSTEM "../../../lib/xml/xsl.dtd" > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0" xmlns:s="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:e="http://markup.co.uk/excel" exclude-result-prefixes="xs s e xf" xmlns="http://markup.co.uk/excel" xmlns:xf="http://www.w3.org/2005/xpath-functions"> + <xsl:param name="sheet-number"/> + <xsl:param name="xlDir"/> + <xsl:variable name="pat1">("[^"]*")|(\{[^}]+})|(,)|([^=\-+*/();:,.$<>^!]+(?:\.[^=\-+*/();:,.$<>^!]+)*\()|([)])|(^=|\()|((?:'[^']+')|(?:\[[0-9]+\][^!]*))|(\$?[A-Z]+\$?[0-9]+)|([a-zA-Z_\\][a-zA-Z0-9._]*)|(.)</xsl:variable> - <xsl:param name="pat" select="$pat1"/> + <xsl:param name="pat" select="$pat1"/><!-- xsl:param for refinement debugging by passing in the pattern --> + + <xsl:variable name="workbook" select="document(concat($xlDir,'/workbook.xml'))/*"/> + <xsl:variable name="sheet-name" select="$workbook/s:sheets/s:sheet[@sheetId=$sheet-number]/@name"/> <xsl:template match="/"> - <refs><xsl:apply-templates select="//s:c"/></refs> + <refs sheetName="{$sheet-name}"><xsl:apply-templates select="//s:c"/></refs> </xsl:template> <xsl:template match="s:c[s:f]"> <xsl:variable name="tokens" select="analyze-string(s:f/.,$pat)/xf:match/xf:group"/> - <xsl:if test="@r='xxx'"><xsl:message><xsl:value-of select="$tokens/@nr"/></xsl:message> + <xsl:if test="@r='A2'"><xsl:message><xsl:value-of select="$tokens/@nr"/></xsl:message> <xsl:message><xsl:value-of select="$tokens/."/></xsl:message> </xsl:if> <xsl:if test="$tokens[@nr=(7,8,9)]">