Click here to Skip to main content
15,885,767 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I am working on a simple project which should allow me to create html input controls with data
defined in an xml file through xslt.

This is my xm data..

XML
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="robust_xsl.xsl"?>
<template>
	<dividers>
		<divider><name> metadata </name></divider>
		<divider><name> themes </name></divider>
		<divider><name> pages </name></divider>
		<divider><name> plugins </name></divider>
	</dividers>	
  
	<metadata>
		<metaName object="entry" name="name" type="text" id="txtName" value=""></metaName>
		<metaDescription object="entry" name="description" type="textarea" id="txtDescription" value=""></metaDescription>
		<metaVersion object="entry" name="version" type="text" id="txtName" value="" otherAttributes="style=width:20px;"></metaVersion>
	</metadata>

	<themes>
		<theme> </theme>
	</themes>
  
</template>



and the xslt for this code is
...............................
XML
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="template">
  <html>
	<body>
	<h2>Template Information Collection form </h2>
		<xsl:for-each select="dividers/divider">
			<fieldset>
				<legend> <xsl:value-of select="name"/> </legend>
				<xsl:for-each select="name">
					
				</xsl:for-each>
			</fieldset>
			<hr/>
		</xsl:for-each>
	</body>
  </html>
</xsl:template>

</xsl:stylesheet>



THE biggest problem i have is i want to navigate through the list of the dividers specified and be able to select each divider entry, search through the xml document for the existence of that node name then process data inside it different...

This is what i mean..
if my divider name = "metadata" i should go to the <metadata> .... </metadata> and collect data between this tag then go to the next divider <themes> ...

I have tried to search the best way to do this but cant get a good approach...have seen using variables but encountered a challenge of modifying the value of that variable.

Please help.
Thanks
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900