RE: [xsl] [xml] repeating elements

Subject: RE: [xsl] [xml] repeating elements
From: cknell@xxxxxxxxxx
Date: Thu, 24 May 2007 15:51:41 -0400
Your question is likely off-topic for this list. But, here's my hunch as to the nature of your problem.

It seems likely that your HTML editor is assuming that any tags it recognizes are in the HTML namespace, and is therefore enforcing HTML rules on them.

Try putting your custom elements in their own namespace:

xmlns:ig="http://garcia/ignacio/schema/number-one";

Then use the "ig:" namespace prefix on your custom elements.

I only use a programmer's editor for any software I develop, so I can't offer a more definitive answer.
--
Charles Knell
cknell@xxxxxxxxxx - email



-----Original Message-----
From:     Ignacio Garcia <igcxslt@xxxxxxxxx>
Sent:     Thu, 24 May 2007 15:21:58 -0400
To:       xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  [xsl] [xml] repeating elements

Hello,

I have the following problem...

I have created a schema that with a complex type that contains a few
html like tags:

<xsd:complexType name="notesText" mixed="true">
	<xsd:sequence minOccurs="0" maxOccurs="unbounded">
		<xsd:element name="b" type="xsd:string" minOccurs="0"/>
		<xsd:element name="i" type="xsd:string" minOccurs="0"/>
		<xsd:element name="p" type="notesText" minOccurs="0"/>
		<xsd:element name="br" minOccurs="0">
			<xsd:simpleType>
				<xsd:restriction base="xsd:string">
					<xsd:length value="0"/>
				</xsd:restriction>
			</xsd:simpleType>
		</xsd:element>
		<xsd:element name="a" minOccurs="0">
			<xsd:complexType mixed="true">
				<xsd:attribute name="href" type="xsd:string" use="required"/>
			</xsd:complexType>
		</xsd:element>
		<xsd:element name="ul" minOccurs="0">
			<xsd:complexType>
				<xsd:sequence maxOccurs="unbounded">
					<xsd:element name="li" type="notesText" minOccurs="0"/>
				</xsd:sequence>
			</xsd:complexType>
		</xsd:element>
     </xsd:sequence>
</xsd:complexType>

As you can see, the type is simple and does exactly what I want...
If I put this inside an element and create an stylesheet using
<xsl:copy-of> I get the desired result of working html code...

HOWEVER, using this definition none of the html editors I have used
lets me add the same html-like-tag two times in a row with text in
between them...

Let me explain:

If my element contains:
----------------
This is some <b>text</b> with <i>html</i> tags on it.
----------------

Everything works perfect...BUT if after that I want to add <i>another
italics</i>, the editor won't let me... If I use a raw text editor,
then I can add it, and the instance is valid, but any xml editor that
helps with tag addition will not let me add the second <i> after I
have used one.

However, if I have some other html-like-tag between the two <i>, then
there is no problem...

Does anyone know why???
I have tried adding <sequence minOccurrs=0" maxOccurrs="unbounded">
surrounding all the html-like elements, but that does not work
either...

Thanks.

Current Thread