I would need help with XML Schema. I would like to write some condition where max occurs of element depend on value of other element
My XML:
<databaza>
<dvd>
<id>01</id>
<type>DVD-R</type>
<number_of_movies>2</number_of_movies>
<movie>
<movie_id>1</movie_id>
<movie_name>X-man</movie_name>
<number_of_characters>2</number_of_characters>
<character>
<character_id>1</character_id>
<character_name>Andy Dufresne</character_name>
<main_character>YES</main_character>
<performer>Tim Robbins</performer>
</character>
<character>
<character_id>2</character_id>
<character_name>Rede</character_name>
<main_character>YES</main_character>
<performer>Morgan Freeman</performer>
</character>
</movie>
<movie>
<movie_id>2</movie_id>
<movie_name>Forrest Gump</movie_name>
<number_of_characters>4</number_of_characters>
<character>
<character_id>1</character_id>
<character_name>Forrest Gump</character_name>
<main_character>YES</main_character>
<performer>Tom Hanks</performer>
</character>
<character>
<character_id>2</character_id>
<character_name>Jenny Curran</character_name>
<main_character>YES</main_character>
<performer>Robin Wright</performer>
</character>
<character>
<character_id>3</character_id>
<character_name>Bubba</character_name>
<main_character>YES</main_character>
<performer>Mykelti Williamson</performer>
</character>
<character>
<character_id>4</character_id>
<character_name>Dan Taylor</character_name>
<main_character>YES</main_character>
<performer>Gary Sinise</performer>
</character>
</movie>
</dvd>
</databaza>
I need some condition which say that the number of <movie>
depends on <number_of_movies>
and then that the number of <character>
depends on <number_of_characters>
And how can I write the condition which say that the <character_id>
going from 1 to max <number_of_characters>
and the same condition for <movie_id>
?