RE: [xsl] Create XML

Subject: RE: [xsl] Create XML
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 17 Apr 2008 12:22:18 +0100
I suspect that what you are looking for is the <xsl:element> instruction.
For example if $n holds the string "Article", and $a is "author", you can
write

<xsl:element name="{$n}">
  <xsl:attribute name="id">abc</xsl:attribute>
  <xsl:element name="{$a}">
    <xsl:attribute name="type">string</xsl:attribute>
  </xsl:element>
</xsl:element> 

Michael Kay
http://www.saxonica.com/

> -----Original Message-----
> From: IZASKUN GUTIERREZ GUTIERREZ 
> [mailto:igutierrez027@xxxxxxxxxxxxx] 
> Sent: 17 April 2008 10:33
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Create XML
> 
> Hello everybody!
> 
> I am doing stylesheets with XSLT 2.0 and I execute they with 
> JAXP (Saxon).
> 
> Depends on the result of the templates, I need to write XML 
> elements, for
> 
> example, in one File:
> 
> <Article  id="abc">
> 
>      <author type="string">Joan Smith</author>
> 
> </Article>
> 
> Can I do this with JAXP or Saxon? What packages I need to use?
> 
> thank you, regards
> 
> Izaskun

Current Thread