473,378 Members | 1,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

XSD minOccurs="0" with transform

If an xsd indicates that an element within a doc is minOccurs="0"
and you're using xsl to transform the doc do you have to do some kind of check prior to doing a transform on the element?

For instance if my output doc had an xsd element defined as
<xs:element name="CertificationDate" type="xs:dateTime" minOccurs="0"/>

and I had an input xml file like
<doc>
<node1> </node1>
<node1><certdate>2006-06-12T00:00:00.000-08:00</certdate> </node1>
</doc>

I want to output to be like:
<doc>
<node1> </node1>
<node1><CertificationDate>2006-06-12T00:00:00.000-08:00</CertificationDate> </node1>
</doc>


What would i need to do in XSL?

<xsl:for-each select="doc/node1">
<node1>
<CertificationDate><xsl:value-of select="cert_date"/></CertificationDate>
</node1>
</xs:for-each>
Jul 25 '07 #1
2 2327
jkmyoung
2,057 Expert 2GB
If you only want it to show when there is a cert_date element, use <xsl:apply-templates/> instead, and add a template for cert_date
<xsl:template match="cert_date">
<CertificationDate><xsl:value-of select="."/></CertificationDate>
</xsl:template>

Otherwise, you've pretty much answered your own question.
Jul 25 '07 #2
Thanks! that's just what I needed
Jul 26 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: joewhitehair | last post by:
Using the XSD.exe tool, I created a number of classes from my XSD file. When I generate the WSDL for my web service, the schema does not have the proper Occurance constraints for the attributes. In...
6
by: TS | last post by:
Hi, i have a problem validating xml against schema. I used http://apps.gotdotnet.com/xmltools/xsdvalidator/Default.aspx validator and it says it is fine. Can you tell me why this doesn't work? ...
3
by: Mike | last post by:
I have created a web service for a client to consume. The element I am having trouble with is, as described in their WSDL: <xsd:element minOccurs="0" ref="LocalData" maxOccurs="1" /> ...
0
by: John Harvey | last post by:
I have been struggling with the following: I want to create a class that contains an array of some user-defined type. so I have the following vb code: Public Class Communications Public...
0
by: Zimri | last post by:
All, I am trying to read an XML of a set of records (an "order") from one machine and then turn it into a set of records on another machine. But some of the order's dependent records are...
2
by: NoNickname | last post by:
Right now I'm getting this in the wsdl: <s:element minOccurs="0" maxOccurs="1" name="Items" type="tns:ArrayOfMyClass" /> I would like to get minOccurs="1" for this webmethod: public...
0
by: Bakunin | last post by:
Hi, I have a brief question regarding the .net framework renders class definitions of schemas to wsdl descritions. I have observed the following: 1. I have a schema with a mandatory field (in...
4
by: BorisBoshond | last post by:
Hi all, Hope someone is able and willing to help me with following problem. I received a xsd file from another company, our company i supposed to return xml based on that xsd. Problem is that I...
1
by: mato81 | last post by:
Hi all! I am a newbie to WSDL. I have a questions which has been driving me crazy... If I would have a WSDL with a types element somewhat like below, what is the point of the third last row...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.