[jdom-interest] (no subject)

Raffaele Sena raff at aromatic.org
Thu Oct 24 10:58:12 PDT 2002


>
> Can you pl suggest me a solution, for this transformation.  Is JDOM
helpful
> for the transormation ?
>
    I thought this message was posted on one of the XSL mailing lists I
subscribe
    and I was wondering why you would ask about JDOM. Then I realized: wrong
list! :)

    Yes, you can probably use JDOM and scan the tree a few times to create a
new structure the way you describe.

    If you are interested in the XSL transformation here is the code (that
you can
    run in your favorite XSLT processor) .

-- Raffaele

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/Employees">
  <Employees>
    <xsl:apply-templates select="employee[@managerId='null']"/>
  </Employees>
</xsl:template>

<xsl:template match="employee">
  <employee id="{@id}" name="{@name}">
    <xsl:variable name="id" select="@id"/>
    <xsl:apply-templates select="../employee[@managerId=$id]"/>
  </employee>
</xsl:template>

</xsl:stylesheet>




More information about the jdom-interest mailing list