Re: Is it possible to merge attributes from multiple elements?

Subject: Re: Is it possible to merge attributes from multiple elements?
From: Edwin Glaser <edwin@xxxxxxxxxxxxxxx>
Date: Sun, 18 Jun 2000 12:30:06 +0200
You wrote:
> I'm trying to write a template that combines attributes from two elements into a 
> single element. The goal is to use XSLT to translate something like this:
> <matrix>
>  <column c="1">
>  <column c="2">
>  <row r="1">
>  <row r="2">
> </matrix>
> into something like this:
> <table>
>  <tr><td c="1" r="1"/><td c="2" r="1"/></tr>
>  <tr><td c="1" r="2"/><td c="2" r="2"/></tr>
> </table>

> As far as I've been able to tell, variables, can't hold anything other than simple 
> text--much less a collection of attribute nodes.

Don't know if it is possible with pure xslt, but with a rtf->nodeset converter
your solution needs only slightly modifications. Here is a xalan example, saxon
has a builtin converter. Let's hope the next xslt specification will remove those
brain-dead limitations!

<?xml version="1.0" encoding="ISO-8859-1" ?>
    xmlns:xsl=""; version="1.0"

<xsl:template match="row">
 <xsl:variable name="this"><xsl:copy-of select="."/></xsl:variable>
  <xsl:for-each select="../column">
   <xsl:for-each select="@*">
   <xsl:for-each select="util:nodeset($this)/*/@*">


public class Util 
  public static XNodeSet nodeset(Node value)
    throws Exception
    Node node = (Node) value;
    return new XNodeSet((Node) value);

Hope it helps, edwin

Edwin Glaser -- edwin@xxxxxxxxxxxxxxx

 XSL-List info and archive:

Current Thread