【发布时间】:2010-07-27 13:04:36
【问题描述】:
我尝试在此处搜索我的问题,但未成功。
<xsl:for-each select="$all_events[g:active = 1]">
<xsl:sort select="g:event_date" order="descending"/>
<xsl:variable name="fileName"><xsl:value-of select="fn:replaceAll(string(@alf:file_name), '.xml', '.html')"/></xsl:variable>
<xsl:variable name="fileURL"><xsl:value-of select="concat('/events/', $fileName)" /></xsl:variable>
<xsl:variable name="fileDate"><xsl:value-of select="g:event_date" /></xsl:variable>
<xsl:variable name="date"><xsl:value-of select="substring($fileDate, 6, 2)" /></xsl:variable>
<li><a href="{$fileURL}"><xsl:value-of select="g:event_title"/></a></li>
</xsl:for-each>
</ul><br/>
<xsl:for-each select="$all_events[g:body/g:current = 1]">
<xsl:for-each select="g:body">
<h2 class="normal"><xsl:value-of select="g:sub_title" /></h2>
<xsl:for-each select="g:paragraphs">
<xsl:value-of select="g:paragraph" disable-output-escaping="yes"/>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
我有两个 for-each 语句检查我的 XSD 的真值或假值:
<xs:simpleType name="confirm">
<xs:restriction base="xs:boolean"/>
</xs:simpleType>
<xs:element name="active" type="g:confirm" minOccurs="0"/>
<xs:element name="current" type="g:confirm" minOccurs="0"/>
以上内容对我不起作用。我也试过true()/false() 似乎也失败了。
我是否遗漏了一些明显的东西?
编辑: 布尔值是 Alfresco CMS 中的复选框,所以我不能简单地检查它的存在,而是检查它的真假。
<xs:simpleType name="confirm">
<xs:restriction base="xs:boolean"/>
</xs:simpleType>
<xs:element name="content">
<xs:complexType>
<xs:sequence>
<xs:element name="page_title" type="xs:normalizedString" minOccurs = "0">
<xs:annotation>
<xs:appinfo>
<alf:appearance>title</alf:appearance>
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="event_title" type="xs:normalizedString" minOccurs = "0">
<xs:annotation>
<xs:appinfo>
<alf:appearance>title</alf:appearance>
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="active" type="g:confirm" minOccurs="0"/>
<xs:element name="event_date" type="xs:date" />
<xs:element name="body" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="sub_title" type="xs:normalizedString" minOccurs = "0">
<xs:annotation>
<xs:appinfo>
<alf:appearance>title</alf:appearance>
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="current" type="g:confirm" minOccurs="0"/>
<xs:element name="paragraphs" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="paragraph" type="xs:string" minOccurs = "0">
<xs:annotation>
<xs:appinfo>
<alf:appearance>custom</alf:appearance>
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
【问题讨论】: