xsl-list
[Top] [All Lists]

Re: [xsl] Wrapping two different elements in parent element - part two

2007-10-15 08:53:47
Hi Bruno,

Then adjust the previous solution output the number element and put as value the previous word_number value if any, otherwise 'sg.'.

<?xml version="1.0"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
 <xsl:output indent="yes"/>
 <xsl:template match="something">
  <something-else>
    <xsl:for-each-group select="*" group-ending-with="word_form">
     <form><xsl:apply-templates select="current-group()"/></form>

    </xsl:for-each-group>

  </something-else>
 </xsl:template>

 <xsl:template match="word_case">
  <case><xsl:value-of select="."/></case>
 </xsl:template>

 <xsl:template match="word_form">
  <form><xsl:value-of select="."/></form>
<number><xsl:value-of select="(preceding-sibling::word_number[1], 'sg.')[1]"></xsl:value-of></number>
 </xsl:template>
</xsl:stylesheet>

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina - http://aboutxml.blogspot.com/
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com


Bruno Nahod wrote:
Dear George (and anybody who red my post) so sorry for the mistake off
course the last <number/> should be "pl." not "sg."
I have check it twice and steel managed to miss it.
Some extra info: the singular is implied in export xml and the beginning
of plural is announced with
  <word_number>pl.</word_number> I hope this helps.
I do apologize once again.

This is what im traying to get:


<something_else>
  <form>
      <case>N</case>
      <orth>some_word_N</orth>
      <number>sg.</number>
  </form>
  <form>
      <case>G</case>
      <orth>some_word_G</orth>
      <number>sg.</number>
  </form>
  <form>
      <case>D</case>
      <orth>some_word_D</orth>
      <number>sg.</number>
  </form>
  <form>
      <case>N</case>
      <orth>some_word_N</orth>
      <number>pl.</number>
  </form>
  <form>
      <case>G</case>
      <orth>some_word_G</orth>
      <number>pl.</number>
  </form>
  <form>
      <case>D</case>
      <orth>some_word_D</orth>
      <number>pl.</number>
  </form>


</something_else>

Best regards
Bruno




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