Hello,
I am working with some pre-existing code and don't know much of anything about xml. I have an xml file that contains form data elements. I have an xsl file that is supposed to create an html wrapper around those elements along with submission buttons. I am not really sure what to write in the xsl file in order to render the form input elements. The line that I was hoping would render my first name text input is:
<xsl:value-of select=" BIOForm /FirstName"/>
But that isn't rendering anything at all.
Help would be greatly appreciated.
Note that I cannot change the xml/xsl methodology being used.
Here is the beginning of my xml:
<?xml version="1.0" encoding="UTF-8"?>
<formView>
<formData>
<artifact>
<metaData>
<displayName/>
<type>
<id>file</id>
<description>file</descrip
tion>
</type>
</metaData>
<structuredData>
<ISD621_Intro/>
</structuredData>
<schema>
<instructions>Fill out this form</instructions>
<element name="BIOForm" minOccurs="1" maxOccurs="1">
<children>
<element name="FirstName" type="xs:token" minOccurs="1" maxOccurs="1">
<xs:simpleType xmlns:xs="
http://www.w3.org/2001/XMLSchema">
<xs:restriction base="xs:token">
<xs:maxLength value="25"/>
</xs:restriction>
</xs:simpleType>
</element>
Here is the beginning of my xsl:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns="
http://www.w3.org/1999/xhtml" xmlns:sakaifn="org.sakaipr
oject.meta
obj.utils.
xml.XsltFu
nctions" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform" xmlns:xhtml="
http://www.w3.org/1999/xhtml" xmlns:osp="
http://www.osportfolio.org/OspML" xmlns:xs="
http://www.w3.org/2001/XMLSchema">
<xsl:template match="formView">
<html xmlns="
http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>
Intr
</title>
</head>
<body style="font-family:Calibri
; font-size:11pt; background-color:#FFFFFF">
<form method="post" onsubmit="a=1;">
<table border="0" style="text-align:left">
<tr style="background-color:#9
5B3D7">
<th span="2" style="font-family:Courier
New; font-size:18pt">
Introduction Form Cust Rend
</th>
</tr>
<tr style="background-color:#F
FFFFF">
<th span="2" style="background-color:#F
FFFFF; height:5px">
</th>
</tr>
<tr style="background-color:#2
44061;colo
r:#FFFFFF"
>
<th>
First Name
</th>
<th>
<xsl:value-of select=" BIOForm /FirstName"/>
</th>
</tr>
The syntax of the select attribute of the instruction <xsl:value-of select=" BIOForm /FirstName"/> is not correct. What you have to enter here is a Xpath query.
The xml file you posted contains an opening <formView> tag, but also a corresponding closing </formView> tag. I suppose you will find between these tags some value you want to use as first name, but since you have cut the file, I can't figure out where you can find that value, and I can't help you to write the xpath query you need.
If you feel the xml file and the xsl file are too big, please attach these instead of posting only a (too little) part of it. I fear you do not understand fully the philosophy behind xsl/xml. I can help you to understand it better, but the elements you provided are not enough. Anyway, <xsl:value-of select="some-xpath-query"/
Please give me more elements.