|
Subject: [xsl] creating elements from semicolon delimited text From: "Flanders, Charles E (US SSA)" <charles.flanders@xxxxxxxxxxxxxx> Date: Wed, 3 Mar 2010 15:07:52 -0500 |
I could use some help manipulating a paragraph of text delimited by a
semicolon into a series of step elements. I need to take note/paragraph and
create a series of steps. I'm using XSLT 2.0.
This:
<note>
<para>Follow-on maintenance: Stuff to do;
More stuff do to; And then even more stuff to do.</para>
</note>
To this:
<followon.maintsk>
<title>FOLLOW ON MAINTENANCE</title>
<step1><para>Stuff to do.</para></step1>
<step1><para>More stuff to do.</para></step1>
<step1><para>And then even more stuff to do.</para><step1>
</followon.maintsk>
I've started with this. However this only captures the first item. And I
realized later would NOT capture the last item, because it ends with a period,
not a semicolon. One note, this is just a small part of much larger transform,
hence the "mode."
<xsl:template match="note" mode="followon">
<xsl:if test="(child::para) and (contains(child::para,'Follow-on'))">
<followon.maintsk>
<title><xsl:text>FOLLOW ON MAINTENANCE</xsl:text></title>
<xsl:variable name="noFollow">
<xsl:value-of select="substring-after(.,':')"/>
</xsl:variable>
<xsl:variable name="steptext">
<xsl:value-of select="substring-before($noFollow,';')"/>
</xsl:variable>
<xsl:for-each select="$steptext">
<step1>
<para>
<xsl:value-of select="$steptext"/><xsl:text>.</xsl:text>
</para>
</step1>
</xsl:for-each>
</followon.maintsk>
</xsl:if>
</xsl:template>
Charles Flanders
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Pattern Substring, Wendell Piez | Thread | Re: [xsl] creating elements from se, Michael Müller-Hille |
| Re: [xsl] Math "functions" for XSLT, Dimitre Novatchev | Date | RE: [xsl] Math "functions" for XSLT, Michael Kay |
| Month |