A variant of this is to use xsl:where-populated:
> <xsl:analyze-string select="." regex="^SUBTASK
(\d+)-(\d+)-(\d+)-((\d+)-(\d+) - \((\d+)\))?$">
> <xsl:matching-substring>
<xsl:where-populated>
> <xsl:attribute name="chapnbr" select="regex-group(1)"/>
> <xsl:attribute name="sectnbr" select="regex-group(2)"/>
> <xsl:attribute name="subnbr" select="regex-group(3)"/>
> <xsl:attribute name="func" select="regex-group(4)"/>
> <xsl:attribute name="seq" select="regex-group(5)"/>
> <xsl:attribute name="revdate" select="regex-group(6)"/>
</xsl:where-populated>
> </xsl:matching-substring>
> </xsl:analyze-string>
>
The xsl:where-populated instruction filters out any attributes whose string
value would be zero-length.
Michael Kay
Saxonica
|