Please try this stylesheet
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:text="http://whatever"
exclude-result-prefixes="text"
version="1.0">
<xsl:output method="xml" indent="yes" />
<xsl:template match="/text:root">
<root>
<xsl:for-each select="text:p">
<xsl:element name="{text:bookmark-start/@text:name}">
<xsl:for-each select="text:user-field-get">
<tag><xsl:value-of select="." /></tag>
</xsl:for-each>
</xsl:element>
</xsl:for-each>
</root>
</xsl:template>
</xsl:stylesheet>
Please note the use of namespace declaration
xmlns:text="http://whatever". This has to be same as in the XML
document.
Regards,
Mukul
On 9/3/05, aaron apigo <aaronjose_apigo2001(_at_)yahoo(_dot_)com> wrote:
Hi All,
I have this sample XML,
<text:root>
<text:p>
<text:bookmark-start text:name="bib1"/>
<text:user-field-get>data1</text:user-field-get>
<text:user-field-get>data2</text:user-field-get>
<text:user-field-get>data3</text:user-field-get>
<text:user-field-get>data4</text:user-field-get>
<text:user-field-get>data5</text:user-field-get>
<text:bookmark-end text:name="bib1"/>
</text:p>
<text:p>
<text:bookmark-start text:name="bib2"/>
<text:user-field-get>data6</text:user-field-get>
<text:user-field-get>data7</text:user-field-get>
<text:user-field-get>data8</text:user-field-get>
<text:user-field-get>data9</text:user-field-get>
<text:user-field-get>dat10</text:user-field-get>
<text:bookmark-end text:name="bib2"/>
</text:p>
<text:p>
<text:bookmark-start text:name="bib3"/>
<text:user-field-get>dat11</text:user-field-get>
<text:user-field-get>dat12</text:user-field-get>
<text:user-field-get>dat13</text:user-field-get>
<text:user-field-get>dat14</text:user-field-get>
<text:user-field-get>dat15</text:user-field-get>
<text:bookmark-end text:name="bib3"/>
</text:p>
</text:root>
and I have this XSL
<xsl:template match ="text:bookmark-start">
<xsl:element="{(_at_)text:name}">
<xsl:for-each select="//text:p/text:user-field-get">
do something here.........
</xsl:for-each>
</xsl:element>
</xsl:template>
what I want is this.
<root>
<bib1>
<tag>data1</tag>
<tag>data2</tag>
.........
</bib1>
<bib2>
<tag>data6</tag>
<tag>data7</tag>
.........
</bib2>
<bib3>
<tag>dat11</tag>
<tag>dat12</tag>
.........
</bib3>
</root>
Using my logic in my sytlesheets, all the
<text:user-field-get> are captured, is there a
possibility that when <for-each> select
<text:bookmark-end text:name="___"/>, <for-each> will
automatically be terminated, and the next
<text:bookmark-start text:name="___"/> will be the one
to process.
regards.
--~------------------------------------------------------------------
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>
--~--