I have one problem with '/'
we have a field which contains multiple values and these values will come separated by a slash '/'.
Now i dont know how to resolve when the values it self contains a '/'.
For eg.

<xsd:Value> Tiger / Lion / Deer</xsd:Value>----This is what is expected and when we tokenize it using '/'
we can get value as Tiger , lion and deer.

But what if Tiger value is chnaged to 'Ti/ger'?
How to escape this slash char in xslt?

Recommended Answers

All 5 Replies

you can ask to put your code to display

it is confusing and there xsd xsl see

double

OK, forgive me If I am wrong. Still very new at this myself. But . . . do you have to use / ? Is it a requirement? Or could you use something like this to enumerate your code.

<xsd:element name="animal">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:enumeration value="Tiger"/>
<xsd:enumeration value="Lion"/>
<xsd:enumeration value="Deer"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>

OOps, sorry, I forgot to use [code]. Also, could you use the more standard | instead of / ?

if you xsd: enumeration used
then you just are still ways to use one of the names of animals

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
	<xsd:element name="zoo">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="animal" maxOccurs="unbounded"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name="animal">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:enumeration value="Tiger"/>
				<xsd:enumeration value="Lion"/>
				<xsd:enumeration value="Deer"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
</xsd:schema>
<?xml version="1.0" encoding="UTF-8"?>
<zoo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:\xml\pet.xsd">
	<animal>
Tiger|Bear|Lion
</animal>
	<animal>
Lion
</animal>
	<animal>
Deer
</animal>
	<animal>
Bear
</animal>
</zoo>

http://www.15seconds.com/issue/031209.htm

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.