我如何在一本书中使用XSLT和jQuery获得动态标题? [英] how i can have a dynamically title in a book with XSLT and jQuery?
本文介绍了我如何在一本书中使用XSLT和jQuery获得动态标题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这个xml:
I have this xml :
<pre lang="xml"><quran>
<row>
<WID>10</WID>
<word>بسم</word>
<SID>1</SID>
<Ayeh>0</Ayeh>
<Joze>1</Joze>
<Hezb>1</Hezb>
<ParentID>4556</ParentID>
<Page>1</Page>
<Joint>1</Joint>
<SName>فاتحه</SName>
</row>
<row>
<WID>11</WID>
<word>الله</word>
<SID>1</SID>
<Ayeh>0</Ayeh>
<Joze>1</Joze>
<Hezb>1</Hezb>
<ParentID>3565</ParentID>
<Page>1</Page>
<Joint>1</Joint>
<SName>فاتحه</SName>
</row>
<row>
<WID>12</WID>
<word>الرحمن</word>
<SID>1</SID>
<Ayeh>0</Ayeh>
<Joze>1</Joze>
<Hezb>1</Hezb>
<ParentID>2876</ParentID>
<Page>1</Page>
<Joint>1</Joint>
<SName>فاتحه</SName>
</row>
<row>
<WID>14</WID>
<word>الْحَمْدُ</word>
<SID>1</SID>
<Ayeh>2</Ayeh>
<Joze>1</Joze>
<Hezb>1</Hezb>
<ParentID>2732</ParentID>
<Page>1</Page>
<Joint>1</Joint>
<SName>فاتحه</SName>
</row>
<row>
<WID>15</WID>
<word>للّهِ</word>
<SID>1</SID>
<Ayeh>2</Ayeh>
<Joze>1</Joze>
<Hezb>1</Hezb>
<ParentID>12105</ParentID>
<Page>1</Page>
<Joint>1</Joint>
<SName>فاتحه</SName>
</row>
<row>
<WID>5618</WID>
<word>بسم</word>
<SID>2</SID>
<Ayeh>0</Ayeh>
<Joze>1</Joze>
<Hezb>1</Hezb>
<ParentID>4556</ParentID>
<Page>2</Page>
<Joint>2</Joint>
<SName>بقره</SName>
</row>
<row>
<WID>5619</WID>
<word>الله</word>
<SID>2</SID>
<Ayeh>0</Ayeh>
<Joze>1</Joze>
<Hezb>1</Hezb>
<ParentID>3565</ParentID>
<Page>2</Page>
<Joint>2</Joint>
<SName>بقره</SName>
</row>
<row>
<WID>5620</WID>
<word>الرحمن</word>
<SID>2</SID>
<Ayeh>0</Ayeh>
<Joze>1</Joze>
<Hezb>1</Hezb>
<ParentID>2876</ParentID>
<Page>2</Page>
<Joint>2</Joint>
<SName>بقره</SName>
</row>
<row>
<WID>4784</WID>
<word>الم</word>
<SID>2</SID>
<Ayeh>1</Ayeh>
<Joze>1</Joze>
<Hezb>1</Hezb>
<ParentID>3567</ParentID>
<Page>2</Page>
<Joint>2</Joint>
<SName>بقره</SName>
</row>
<row>
<WID>5105</WID>
<word>ذَلِكَ</word>
<SID>2</SID>
<Ayeh>2</Ayeh>
<Joze>1</Joze>
<Hezb>1</Hezb>
<ParentID>7234</ParentID>
<Page>2</Page>
<Joint>2</Joint>
<SName>بقره</SName>
</row>
<quran>
我需要插入< sname>在标签之前< ayeh>即< ayeh> 0。我写了一个jquery代码,但我不知道我如何在jquery中使用xslt?(下面的代码不工作)
I need insert the <sname> before tags <ayeh> that is <ayeh>0 . i write a jquery code but i dont know how i use xslt in jquery ?(below code Dont work)
$('.quranText .ayaNumber').each(function(){
if($.trim($(this).text())=='﴿0﴾')
$(this).closest('.aya').prepend('<div class="suraHeaderFrame">'
+'<div class="suraHeaderText">'+
<xsl:for-each-group select="//row[./Page/text()=$page]" group-by="Page">
<xsl:for-each-group select="current-group()" group-by="SID">
<xsl:for-each-group select="current-group()" group-by="concat(Page,SID)">
<xsl:choose >
<xsl:when test = "./Ayeh = 1 or ./Ayeh = 0" >
<xsl:value-of select="SName"/>
</xsl:when>
</xsl:choose>
</xsl:for-each-group>
</xsl:for-each-group>
</xsl:for-each-group>
+'</div>'
+'</div>');
});
I should say that often in a one page is alot of <ayeh>0. I am writing a site same this : http://tanzil.net/#109:1 .
I should say that often in a one page is alot of <ayeh>0. I am writing a site same this : http://tanzil.net/#109:1 .
推荐答案
('.quranText .ayaNumber').each(function(){
if(
('.quranText .ayaNumber').each(function(){ if(
.trim(
(this).text())=='﴿0﴾')
(this).text())=='﴿0﴾')
这篇关于我如何在一本书中使用XSLT和jQuery获得动态标题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文