Xalan redirect:write , use either of two element values to create name of new .xml file depending on
Posted
by Bilzac
on Stack Overflow
See other posts from Stack Overflow
or by Bilzac
Published on 2010-05-26T20:13:23Z
Indexed on
2010/05/26
21:51 UTC
Read the original article
Hit count: 272
So I have the following code:
<redirect:write select="concat('..\\folder\\,string(filename),'.xml')">
Where "filename" is a tag in the xml source. My problem occurs when filename is null or blank. And this is the case for several of the xml filename tags. So what I am trying to implement is a checking method. This is what I have done:
<xsl-if test = "filename != ''">
<xsl:variable name = "tempName" select = "filename" />
</xsl-if>
<xsl-if test ="filename = ''">
<xsl:variable name = "tempName" select = "filenameB"/>
</xsl-if>
<redirect:write select="concat('..\\folder\\,string($tempName),'.xml')">
I seem to be getting NPEs when I compile my Java code, saying the Variable not resolvable: tempName
© Stack Overflow or respective owner