Mercurial > hg > ooxml
view refs.xsl @ 37:ac3cd8de7a10
towards big rework of tokenisation
author | Henry S. Thompson <ht@markup.co.uk> |
---|---|
date | Tue, 25 Apr 2017 18:30:04 +0100 |
parents | ae605b77d1e4 |
children | 468a6cf8bf0b |
line wrap: on
line source
<?xml version='1.0'?> <!DOCTYPE xsl:stylesheet 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:template match="/"> <refs sheetName="{$sheet-name}"><xsl:apply-templates select="//s:c"/></refs> </xsl:template> <xsl:template match="s:c[s:f]"> <xsl:variable name="cr" select="e:cr(@r,0,0)"/> <xsl:variable name="tokens" select="e:tokenise(s:f/.,$cr/e:r[1],$cr/e:r[2])"/> <xsl:if test="@r='xxx'"><xsl:message><xsl:value-of select="s:f"/>|<xsl:value-of select="(analyze-string(s:f/.,$pat)/xf:match/xf:group)[3]/@nr"/></xsl:message> </xsl:if> <xsl:if test="count($tokens)>0"> <xsl:variable name="singles" select="$tokens?1"/> <!-- Note that we don't bother to treat external ranges as ranges, since we're not going to try to detect cross-document refs --> <xsl:variable name="ranges" select="$tokens?2"/> <xsl:variable name="externals" select="$tokens?3"/> <!-- Lost distinct-values filter, not sure it's really possible... --> <ref c="{@r}"> <xsl:copy-of select="$singles"/> <xsl:copy-of select="$ranges"/> <xsl:copy-of select="$externals"/> </ref></xsl:if> </xsl:template> <xsl:template match="s:c"/> </xsl:stylesheet>