xsl-list
[Top] [All Lists]

RE: matching positional nodes

2005-07-08 16:18:35
I would do something like

<xsl:template match="bold[1]">
<sectionnumber><xsl:value-of select="."/></sectionnumber>
</xsl:template>

<xsl:template match="bold">
<xsl:copy-of select="."/>
</xsl:template>

Michael Kay
http://www.saxonica.com/ 

-----Original Message-----
From: Spencer Tickner [mailto:spencertickner(_at_)gmail(_dot_)com] 
Sent: 07 July 2005 17:49
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] matching positional nodes

Hi Everyone, thanks in advance for the help.

I am translating from xml to xml.

Original (just a snippet)

<section><bold>1</bold>This is a section with 
<bold>text</bold></section>

What I need

<section>
  <sectionnumber>1</sectionnumber>
  <sectiontext>This is a section with <bold>text</bold></sectiontext>
</section>

What I've tried

<xsl:template match="section">
   <section>
    <sectionnumber><xsl:apply-templates 
select="BOLD[1]"/></sectionnumber>
    <sectiontext><xsl:apply-templates 
select="*[not(BOLD[1])]"/></sectiontext>
  </section>
</xsl:template>

So far what I'm getting as output is

<section>
<sectionnumber>1</sectionnumber>
<sectiontext>1text</sectiontext>
</section>

Pretty close but not quite there. Anyone have any ideas on that
apply-template select?

Thanks a lot,

Spencer

--~------------------------------------------------------------------
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>