[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] parsing xsl file in java


Subject: RE: [xsl] parsing xsl file in java
From: Jarno.Elovirta@xxxxxxxxx
Date: Wed, 25 Feb 2004 12:54:28 +0200

Hi,

> Can any one please help me by guiding how can I parse an xsl 
> file through
> Java Servlets and replace a node's attribute in it.

I don't really understand what you mean when you say you want to "parse an xsl file through Java Servlets", but see the JAXP API how to make XSLT transformations in a Java program, and the XSLT for replacing an attribute is something in the lines of

  <xsl:template match="foo/@bar">
    <xsl:attribute name="baz">qux</xsl:attribute>
  </xsl:template>
  <xsl:template match="@* | node()">
    <xsl:copy>
      <xsl:apply-templates select="@* | node()"/>
    </xsl:copy>
  </xsl:template>

Cheers,

Jarno - This Morn' Omina: The Immutable sphere

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



Current Thread
Keywords