This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Debugging.... Conditionally including XML


This might be more of an XML related question than XSL...

My XML file looks something like this

<page>
	<content>
		<dataReference name="test" />
	</content>
	<data>
		<item name="test">This is a data value</item>
	</data>
</page>

I write the content part of the page by hand and the data portion is
returned to me.
Within my xsl I might have something like this

<xsl:template match="dataReference">
	<xsl:variable name="referenceName"><xsl:value-of  select="@name"
/></xsl variable>
	<xsl:value-of select="/page/data/item[$referenceName = @name]" />
</xsl:template>

What I would like to know is if there is any way to conditionally add XML to
my XML document. Im looking for a way to be able to debug the XML/XSL before
the data section of the XML document is being populated by the
backend/middle tier developers.  Currently how I do this is just write the
data section of the page and either remove it or comment it out when Im
actually getting data. Im getting sick of commenting and un-commenting stuff
(and I cant count the number of times we have checked in an XML file to
source control with the data section still uncommented). It is just a
general annoyance but I would like to fix it if I could. 

I would like to be able to do something like this in my XML file...
<page>
	<content>....</content>
	if (debug = true)
		Include a debug data file, which would contain the data and
item tags
	else
		The data and item tags will be returned to me.
</page>

Thanks
John


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]