xsl-list
[Top] [All Lists]

RE: [xsl] Select following siblings with constraints (a solution)

2009-02-06 15:17:09

This is a test post.

&#lt; test /&#gt; 

&    &    &    &    ampersand
  >    >   >    greater-than sign
<     From: mas_christ(_at_)hotmail(_dot_)com
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Date: Wed, 4 Feb 2009 23:46:03 +0000
Subject: [xsl] Select following siblings with constraints (a solution)


Wednesday February 4 2009

This may be an answer or a help to the following I found at Altova Mailing 
List Archives entitled, "select immediately following siblings with 
constraints"
http://www.altova.com/list/xsl-list/200602/msg1000146300.html
-------------
Problem: Select following siblings with constraints.
-------------
Theory solution: use the xsl:generate-id() function on the node that preceeds 
the following siblings you want to select.  Have the following siblings copy 
that id.
-------------
Working solution:  The following two xsl stylesheets (convert.xsl and 
convertstage2.xsl) put the v nodes belonging to its' chapter into the 
bookChapter node (after bookChapter was changed into a chapter node).  The 
generate-id() function was not needed because the bookChapter node already 
has unique information.
-------------
The demo.xml follows:
-------------


Isaiah
The Book of the Prophet Isaiah
Chapter 1
Judah's rebellion -- Promises and threatenings.
1 The vision of Isaiah the son of Amoz, which he saw concerning Judah and 
Jerusalem in the days of Uzziah, Jotham, Ahaz, and Hezekiah, kings of Judah.
2 Hear, O heavens, and give ear, O earth; for the Lord hath spoken; I have 
nourished and brought up children, and they have rebelled against me.
Chapter 2
The coming of Christ's kingdom -- Effects of God's majesty.
1 The word that Isaiah the son of Amoz saw concerning Judah and Jerusalem.
2 And it shall come to pass in the last days when the mountain of the Lord's 
house shall be established in the top of the mountains, and shall be exalted 
above the hills, and all nations shall flow unto it;
Chapter 3
The sin of the people -- The oppression of the rulers -- The judgments for 
pride.
1 For, behold, the Lord, the Lord of hosts, doth take away from Jerusalem and 
from Judah the stay and the staff, the whole staff of bread, and the whole 
stay of water,
2 The mighty man, and the man of war, the judge, and the prophet, and the 
prudent, and the ancient,

-------------
The following are the commands (demo.sh) used to make the final document:
-------------
find . -iname "demo.xml" -exec sed -i 
"s(_at_)demo(_dot_)xsl@convert(_dot_)xsl(_at_)g" {} ';'

xsltproc demo.xml -o demo.xml --norman

find . -iname "demo.xml" -exec sed -i "s@@@g" {} ';'

xsltproc demo.xml -o demo.xml --norman

#the following sed command removes space at the beginning of lines:
sed -i 's/^[ \t]*//;s/[ \t]*$//' isaiah.xml;
-------------
The convert.xsl follows:
-------------
























-------------
The convertstage2.xsl follows:
-------------

























-------------
Final result follows (v nodes have been moved into chapter nodes):
-------------


Isaiah
The Book of the Prophet Isaiah

1
Judah's rebellion -- Promises and threatenings.
1 The vision of Isaiah the son of Amoz, which he saw concerning Judah and 
Jerusalem in the days of Uzziah, Jotham, Ahaz, and Hezekiah, kings of Judah.
2 Hear, O heavens, and give ear, O earth; for the Lord hath spoken; I have 
nourished and brought up children, and they have rebelled against me.


2
The coming of Christ's kingdom -- Effects of God's majesty.
1 The word that Isaiah the son of Amoz saw concerning Judah and Jerusalem.
2 And it shall come to pass in the last days when the mountain of the Lord's 
house shall be established in the top of the mountains, and shall be exalted 
above the hills, and all nations shall flow unto it;


3
The sin of the people -- The oppression of the rulers -- The judgments for 
pride.
1 For, behold, the Lord, the Lord of hosts, doth take away from Jerusalem and 
from Judah the stay and the staff, the whole staff of bread, and the whole 
stay of water,
2 The mighty man, and the man of war, the judge, and the prophet, and the 
prudent, and the ancient,


-------------
Note:  I don't know how to make it work with a single xsl file yet.
-------------
libxslt 1.1.20 was used.
-------------


_________________________________________________________________
Windows Live™: E-mail. Chat. Share. Get more ways to connect. 
http://windowslive.com/howitworks?ocid=TXT_TAGLM_WL_t2_allup_howitworks_022009
--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
--~--


_________________________________________________________________
Windows Live™: E-mail. Chat. Share. Get more ways to connect. 
http://windowslive.com/howitworks?ocid=TXT_TAGLM_WL_t2_allup_howitworks_022009
--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>