xsl-list
[Top] [All Lists]

Re: [xsl] Using analyze-string to add tabs

2011-09-20 06:08:11
The regex attribute of xsl:analyze-string is an attribute value template, so if it contains curly braces they must be doubled.

People sometimes find it more convenient to put the regex in a variable, and then use regex="{$regex}".

Michael Kay
Saxonica

On 20/09/2011 09:39, Jeff Wilson wrote:
Good morning,

I'm just trying to add tabs to the text of certain elements. It seems to be much harder than I anticipated.

Any help would be greatly appreciated.

Thanks,
Jeff

Input:

<root>
<ListNumbered aid:pstyle="ListNumbered">1.To access the native file reader’s menu, navigate to Global Options File Readers.</ListNumbered> <ListNumbered aid:pstyle="ListNumbered">2.In the Options Editor, expand the File Readers hierarchy on the left, as shown in Figure 2.4.</ListNumbered>
</root>

Desired output:

<root>
<ListNumbered>&#09;1.&#09;To access the native file reader’s menu, navigate to Global Options File Readers.</ListNumbered> <ListNumbered>&#09;2&#09;.In the Options Editor, expand the File Readers hierarchy on the left, as shown in Figure 2.4.</ListNumbered>
</root>

XSLT to date, but I'm stumped:

<xsl:for-each select="current-group()">
<xsl:choose>
<xsl:when test="contains(@aid:pstyle, 'ListNumbered')">
<xsl:analyze-string select="." regex="(\d{1,3}\.)(.*?)">
<xsl:matching-substring>
<xsl:text>&#09;</xsl:text><xsl:value-of select="regex-group(1)"/><xsl:text>&#09;</xsl:text><xsl:value-of select="regex-group(2)"/></xsl:element><xsl:text>&#xA;</xsl:text>
</xsl:matching-substring>
</xsl:analyze-string>
</xsl:when>
<xsl:choose>
</xsl:for-each>
--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>