Hi All,
I'm wondering if someone can help me with a convoluted XPath I am trying to
write. The goal is to restrict the output of an itemset if the item
referred to matches certain conditions stored in a different instance.
This is what I am currently attempting:
<xf:itemset ref="instance('i-schemaConstraints')/*[local-name() =
local-name($currentNode)][1]/*:childElements[1]/*:element[count($currentNode/child::*[local-name()
= @ident]) < @maxOccurs]">
<xf:label ref="@ident"/>
<xf:value ref="@ident"/>
</xf:itemset>
The problem is I think I lose the context for the @ident attribute. I'm
attaching a very simple example form that illustrates the problem.
I am using XSLTForms version 1.7
Thanks for your help,
-Winona
<?xml-stylesheet href="xsl/xsltforms.xsl" type="text/xsl"?><html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:tei="http://www.tei-c.org/ns/1.0">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta charset="utf-8"/>
<title>Bug Demo</title>
<xf:model id="m-mss">
<xf:instance id="i-rec">
<TEI xmlns="http://www.tei-c.org/ns/1.0">
<titleStmt>
<title></title>
<title></title>
<title></title>
<author></author>
<date></date>
</titleStmt>
</TEI>
</xf:instance>
<xf:instance id="i-availableElements">
<TEI xmlns="http://www.tei-c.org/ns/1.0">
<titleStmt></titleStmt>
<title></title>
<author></author>
<date></date>
</TEI>
</xf:instance>
<xf:instance id="i-schemaConstraints">
<TEI xmlns="http://www.tei-c.org/ns/1.0">
<titleStmt>
<childElements>
<element ident="title" label="title" minOccurs="0" maxOccurs="2"/>
<element ident="author" label="author" minOccurs="0" maxOccurs="2"/>
<element ident="date" label="date" minOccurs="0" maxOccurs="1"/>
</childElements>
</titleStmt>
</TEI>
</xf:instance>
</xf:model>
</head>
<body>
<h2 class="h3 mainElement">Identification </h2>
<xf:repeat ref="instance('i-rec')//tei:titleStmt" id="titleStmtLevel1">
<div id="elementGroup" style="margin:12px; padding:12px; border:1px solid #ccc;">
<b><span class="element">Element Name: <xf:output value="name()"/></span><br/></b>
<xf:var name="currentNode" value="."/>
<xf:var name="elements" value="instance('i-schemaConstraints')/*[local-name() = local-name(current())][1]/*:childElements[1]/*:child/*:element"/>
Available Elements :
<xf:select1 xmlns="http://www.w3.org/2002/xforms" ref="instance('i-availableElements')/*[local-name() = local-name(current())]">
<xf:label/>
<xf:itemset ref="instance('i-schemaConstraints')/*[local-name() = local-name($currentNode)][1]/*:childElements[1]/*:element[count($currentNode/child::*[local-name() = @ident]) < @maxOccurs]">
<xf:label ref="@ident"/>
<xf:value ref="@ident"/>
</xf:itemset>
</xf:select1>
<br/>
<span class="element">Child Name: <xf:repeat xmlns="http://www.w3.org/2002/xforms" ref="child::*"><xf:output value="name()"/></xf:repeat></span>
</div>
</xf:repeat>
</body>
</html>
_______________________________________________
Xsltforms-support mailing list
Xsltforms-support@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xsltforms-support