how do indirection in value-of or select?

Subject: how do indirection in value-of or select?
From: "Mark D. Anderson" <mda@xxxxxxxxxxxxxx>
Date: Fri, 26 Feb 1999 19:43:47 -0800
my xml is some database metadata that includes declarations of
"domains" and "columns", among other things. "domains", for those
not into rdbms-speak, are sort of like abstract types. each
column has a domain, and each domain has its physical type.
like this:

<root>
 <domain name="email" dbtype="varchar2(100)"/>
 <domain ... />
 ...
 <table name="mytable">
   <column name="mycolumn" domain="email"/>
 </table>
 ...
</root>

now i'd like to produce an xsl style sheet that can print out
something like this:
create table mytable (
   mycolumn varchar2(100);
);

any suggestions? this obviously doesn't cut it:

<xsl:for-each select="table">
create table <xsl:value-of select="@name"/> (
 <xsl:for-each select="column">
 <xsl:value-of select="@name"/>
 <xsl:value-of select="@domain"> <!-- do what here? -->
 </xsl:for-each>
</xsl:for-each>

this doesn't work either for the tricky line:
  <xsl:apply-templates select="ancestor(root)/domain=@domain"/>

i'm willing to change the syntax of the xml if that helps,
but it does seem like xsl should have some way to do this.
macros? constants? producing elements that are then processed
again by the processor? or can xsl just not do a join?

-mda



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread