I'm having trouble getting tokenize() to behave the way I expect it to.  As 
before, I have an element with an attribute @target with type idrefs.  I want 
to split the value into the individual idrefs (I will run more complicated 
tests on them, but for the moment I'm just trying to get access to them).  In 
the attached document and schema, I have two assertions.  The first, using 
matches() succeeds, but the second, using tokenize(), fails:

<xsd:assert test="matches(string(@target), '\S+(\s+\S+)+')" 
xpathDefaultNamespace="##targetNamespace"/>
<xsd:assert test="boolean(tokenize(string(@target), '\s+'))"  
xpathDefaultNamespace="##targetNamespace"/>

What am I doing wrong?

Thanks,
Jim

Attachment: sample.scxml
Description: sample.scxml

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";
    targetNamespace="http://www.w3.org/2005/07/scxml";
    xmlns="http://www.w3.org/2005/07/scxml";
    elementFormDefault="qualified">
	

	<!-- scxml -->
	<xsd:attributeGroup name="scxml.scxml.attlist">
		<xsd:attribute name="initial" type="xsd:IDREFS"/>
		<xsd:attribute name="version" type="xsd:decimal" use="required" fixed="1.0"/>
	</xsd:attributeGroup>
	<xsd:group name="scxml.scxml.mix">
		<xsd:choice>
			<xsd:element ref="state" minOccurs="0" maxOccurs="unbounded"/>
		</xsd:choice>
	</xsd:group>
	<xsd:group name="scxml.scxml.content">
		<xsd:sequence>
			<xsd:group ref="scxml.scxml.mix" minOccurs="0" maxOccurs="unbounded"/>
		</xsd:sequence>
	</xsd:group>
	<xsd:complexType name="scxml.scxml.type">
		<xsd:group ref="scxml.scxml.content"/>
		<xsd:attributeGroup ref="scxml.scxml.attlist"/>
	</xsd:complexType>
	<xsd:element name="scxml" type="scxml.scxml.type"/>

	<!-- state -->
	<xsd:attributeGroup name="scxml.state.attlist">
		<xsd:attribute name="id" type="xsd:ID"/>
		<xsd:attribute name="initial" type="xsd:IDREFS"/>
	</xsd:attributeGroup>
	<xsd:group name="scxml.state.mix">
		<xsd:choice>
			<xsd:element ref="transition" minOccurs="0" maxOccurs="unbounded"/>
			<xsd:element ref="state" minOccurs="0" maxOccurs="unbounded"/>
		</xsd:choice>
	</xsd:group>
	<xsd:group name="scxml.state.content">
		<xsd:sequence>
			<xsd:group ref="scxml.state.mix" minOccurs="0" maxOccurs="unbounded"/>
		</xsd:sequence>
	</xsd:group>
	<xsd:complexType name="scxml.state.type">
		<xsd:sequence>
			<xsd:group ref="scxml.state.content"/>
		</xsd:sequence>	
		<xsd:attributeGroup ref="scxml.state.attlist"/>		
	</xsd:complexType>
	<xsd:element name="state" type="scxml.state.type"/>


	<!-- transition -->
	<xsd:attributeGroup name="scxml.transition.attlist">
		<xsd:attribute name="target" type="xsd:IDREFS"/>
	</xsd:attributeGroup>
<xsd:group name="scxml.transition.mix">
		<xsd:choice>
			<xsd:element ref="transition" minOccurs="0" maxOccurs="unbounded"/>
			<xsd:element ref="state" minOccurs="0" maxOccurs="unbounded"/>
		</xsd:choice>
	</xsd:group>
	<xsd:group name="scxml.transition.content">
		<xsd:sequence>
			<xsd:group ref="scxml.transition.mix" minOccurs="0" maxOccurs="unbounded"/>
		</xsd:sequence>
	</xsd:group>
	<xsd:complexType name="scxml.transition.type">
			<xsd:sequence>
			<xsd:group ref="scxml.transition.content"/>
		</xsd:sequence>	
		<xsd:attributeGroup ref="scxml.transition.attlist"/>
		<xsd:assert test="matches(string(@target), '\S+(\s+\S+)+')" xpathDefaultNamespace="##targetNamespace"/>
		<xsd:assert test="boolean(tokenize(string(@target), '\s+'))"  xpathDefaultNamespace="##targetNamespace"/>
	</xsd:complexType>
	<xsd:element name="transition" type="scxml.transition.type"/>


</xsd:schema>
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
For additional commands, e-mail: j-users-h...@xerces.apache.org

Reply via email to