[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Is it possible to nest templates? If not, how to combi
Hi, Processor: Xalan 2.7.0 on Windows xsl1: I have a template that goes through xml topics to create troff output. xsl2: I also have another xml file that has attributes such as product name and version that I want to be able to include when processing the xml topics in 1. I have created a separate stylesheet to do this. Issue: How do I combine both stylesheets so that in xsl1 I can retrieve the values in index.xml? When I try to nest templates, it does not work. When I try to include this stylesheet with another template, index.xml gets overwritten and becomes blank. If I don't use template match="/", nothing works. Any ideas? Xsl2: (works just fine from the command-line by itself) <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:redirect="http://xml.apache.org/xalan/redirect" extension-element-prefixes="redirect"> <redirect:open file="index.xml"/><xsl:template match="/"> <xsl:variable name="product"><xsl:value-of select="/names/prodname"/></xsl:variable> <xsl:variable name="versions"> <xsl:value-of select="/names/prodversion"/></xsl:variable> <xsl:message><xsl:value-of select="$product"/></xsl:message> <xsl:message><xsl:value-of select="$versions"/></xsl:message> </xsl:template> <redirect:close file="index.xml"/> </xsl:stylesheet> In xsl1, I want to be able to open the file that has the right attributes, and include the information when generating the topics in xsl1. Xsl1. This is what I'm trying to do and it does not work. How do I not use template match="/"? How do I include one template within another? <xsl:template name="set-date"> <redirect:open file="index.xml"/><xsl:template match="/"> <xsl:variable name="product"><xsl:value-of select="/names/prodname"/></xsl:variable> <xsl:variable name="versions"> <xsl:value-of select="/names/prodversion"/></xsl:variable> <xsl:message><xsl:value-of select="$product"/></xsl:message> <xsl:message><xsl:value-of select="$versions"/></xsl:message> </xsl:template> <redirect:close file="index.xml"/> <xsl:choose> <xsl:when test="$OUTFORMAT='plaintext'"><xsl:value-of select="$newline"/></xsl:when> <xsl:when test="$OUTFORMAT='troff' or $OUTFORMAT='nroff'"> <xsl:value-of select="$newline"/>.ds ]W %<xsl:value-of select="$newline"/> <xsl:value-of select="$newline"/>.ds ]L<xsl:value-of select="$newline"/> <xsl:value-of select="$newline"/>.hy 0<xsl:value-of select="$newline"/> <xsl:value-of select="$newline"/>.nh<xsl:value-of select="$newline"/> <xsl:value-of select="$newline"/>.na<xsl:value-of select="$newline"/> <xsl:value-of select="$newline"/>.TH <xsl:value-of select="$newline"/> <xsl:value-of select="$newline"/><xsl:value-of select="date:month-name()"/> <xsl:text> </xsl:text><xsl:value-of select="date:year()"/><xsl:text> </xsl:text> </xsl:when> </xsl:choose> </xsl:template> Hope you can help, thanks a lot, Carla
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|