I have 2 tables attendance and people.
I need to get the AVG of attendance by range of year.
To do that I need get the column people.DT_NASCIMENTO_FUNDACAO (DATE) and attendance.DT_SOLICITACAO_ATENDIMENTO (DATE).
The result this query should be something like:
-------------------------
| 0 - 18 | 19 - 23| ... |
-------------------------
| 0.2 | 0.8 | ... |
-------------------------
where 0.2 and 0.8 is a decimal representation of fraction of attendance by range of year.
people have CD_PESSOA PK and attendance have NU_USUARIO LIKE FK.
______ ____________
|PEOPLE| 1 ------------------> N | ATTENDANCE |
------- ------------
I created a code that count the numbers of time that a range of year happen:
SELECT
SUM(CASE
WHEN EXTRACT(YEAR FROM TO_DATE(P.DT_NASCIMENTO_FUNDACAO))
BETWEEN EXTRACT(YEAR FROM TO_DATE(G.DT_SOLICITACAO_ATENDIMENTO)) - 18
AND EXTRACT(YEAR FROM TO_DATE(G.DT_SOLICITACAO_ATENDIMENTO))
THEN 1 ELSE 0 END) AS "0 - 18",
SUM(CASE
WHEN EXTRACT(YEAR FROM TO_DATE(P.DT_NASCIMENTO_FUNDACAO))
BETWEEN EXTRACT(YEAR FROM TO_DATE(G.DT_SOLICITACAO_ATENDIMENTO)) - 23
AND EXTRACT(YEAR FROM TO_DATE(G.DT_SOLICITACAO_ATENDIMENTO)) - 19
THEN 1 ELSE 0 END) AS "19 - 23"
FROM ATTENDANCE G JOIN PEOPLE P
ON (G.NU_USUARIO = P.CD_PESSOA)
WHERE EXTRACT(YEAR FROM TO_DATE(G.DT_SOLICITACAO_ATENDIMENTO)) >= EXTRACT(YEAR FROM SYSDATE) - 1
AND EXTRACT(YEAR FROM TO_DATE(G.DT_SOLICITACAO_ATENDIMENTO)) <= EXTRACT(YEAR FROM SYSDATE);
As result I have:
Now, I need change this result to show me the percentual representation. How can I do that?
Here in this link I crate the sql file to create the tables and insert sample data(50 people and 2000 attendances).
Here we have some 50 sample data about born and 1000 attendance date.
people.DT_NASCIMENTO_FUNDACAO
01-07-2010
15-09-2014
10-07-1970
26-01-1989
02-05-1982
09-05-2009
25-08-2006
02-12-2013
08-04-2008
11-01-1962
01-05-1980
11-11-1993
15-07-2013
03-03-1990
09-10-2013
31-12-2008
25-07-2015
16-06-1972
03-11-1985
03-11-2006
19-03-1955
03-01-1974
08-01-2015
13-11-2003
07-01-1989
22-01-2007
30-11-1999
04-12-1970
24-05-1983
25-04-2012
11-11-1988
16-09-1980
21-05-1989
01-06-2011
14-09-1973
16-10-2015
10-02-2000
30-10-2004
27-02-1965
30-01-2015
23-05-1993
07-01-1987
04-03-1998
22-10-2011
17-12-1999
19-02-1955
21-07-1961
attendance.DT_SOLICITACAO_ATENDIMENTO
18-09-2020
21-09-2020
18-09-2020
18-09-2020
18-09-2020
18-09-2020
30-09-2020
30-09-2020
30-09-2020
14-09-2020
23-09-2020
18-09-2020
18-09-2020
18-09-2020
18-09-2020
08-09-2020
08-09-2020
08-09-2020
08-09-2020
08-09-2020
08-09-2020
08-09-2020
08-09-2020
18-09-2020
21-09-2020
21-09-2020
04-09-2020
04-09-2020
04-09-2020
04-09-2020
04-09-2020
08-09-2020
08-09-2020
08-09-2020
09-09-2020
25-08-2020
25-08-2020
25-08-2020
25-08-2020
01-09-2020
01-09-2020
01-09-2020
01-09-2020
01-09-2020
01-09-2020
01-09-2020
01-09-2020
01-09-2020
08-09-2020
17-09-2020
08-09-2020
08-09-2020
08-09-2020
17-09-2020
08-09-2020
08-09-2020
08-09-2020
08-09-2020
08-09-2020
08-09-2020
08-09-2020
08-09-2020
08-09-2020
08-09-2020
08-09-2020
21-09-2020
13-10-2020
04-09-2020
18-09-2020
18-09-2020
18-09-2020
18-09-2020
18-09-2020
18-09-2020
18-09-2020
18-09-2020
18-09-2020
18-09-2020
21-09-2020
21-09-2020
21-09-2020
18-09-2020
23-09-2020
18-09-2020
23-09-2020
18-09-2020
18-09-2020
18-09-2020
18-09-2020
18-09-2020
21-09-2020
21-09-2020
28-09-2020
28-09-2020
28-09-2020
28-09-2020
28-09-2020
28-09-2020
28-09-2020
29-09-2020
28-09-2020
28-09-2020
28-09-2020
28-09-2020
28-09-2020
28-09-2020
28-09-2020
28-09-2020
28-09-2020
28-09-2020
28-09-2020
28-09-2020
25-09-2020
25-09-2020
25-09-2020
25-09-2020
28-09-2020
24-09-2020
16-09-2020
16-09-2020
16-09-2020
16-09-2020
16-09-2020
16-09-2020
16-09-2020
16-09-2020
16-09-2020
16-09-2020
16-09-2020
16-09-2020
16-09-2020
16-09-2020
16-09-2020
16-09-2020
18-09-2020
03-08-2019
03-08-2019
03-08-2019
03-08-2019
02-08-2019
02-08-2019
02-08-2019
02-08-2019
09-08-2019
09-08-2019
09-08-2019
09-08-2019
09-08-2019
09-08-2019
09-08-2019
09-08-2019
09-08-2019
09-08-2019
09-08-2019
09-08-2019
09-08-2019
09-08-2019
09-08-2019
09-08-2019
09-08-2019
22-08-2019
22-08-2019
22-08-2019
22-08-2019
22-08-2019
22-08-2019
22-08-2019
22-08-2019
22-08-2019
22-08-2019
22-08-2019
22-08-2019
22-08-2019
22-08-2019
23-08-2019
23-08-2019
23-08-2019
23-08-2019
23-08-2019
23-08-2019
23-08-2019
23-08-2019
23-08-2019
23-08-2019
23-08-2019
23-08-2019
23-08-2019
23-08-2019
23-08-2019
23-08-2019
30-08-2019
30-08-2019
30-08-2019
30-08-2019
30-08-2019
30-08-2019
30-08-2019
30-08-2019
30-08-2019
30-08-2019
30-08-2019
30-08-2019
30-08-2019
30-08-2019
30-08-2019
30-08-2019
30-08-2019
30-08-2019
30-08-2019
30-08-2019
30-08-2019
30-08-2019
30-08-2019
27-08-2019
27-08-2019
27-08-2019
27-08-2019
27-08-2019
27-08-2019
27-08-2019
21-08-2019
21-08-2019
21-08-2019
21-08-2019
21-08-2019
21-08-2019
21-08-2019
21-08-2019
21-08-2019
21-08-2019
21-08-2019
21-08-2019
21-08-2019
21-08-2019
21-08-2019
21-08-2019
21-08-2019
21-08-2019
27-08-2019
27-08-2019
27-08-2019
27-08-2019
27-08-2019
27-08-2019
27-08-2019
27-08-2019
27-08-2019
27-08-2019
27-08-2019
27-08-2019
21-08-2019
21-08-2019
21-08-2019
21-08-2019
21-08-2019
21-08-2019
21-08-2019
21-08-2019
21-08-2019
21-08-2019
21-08-2019
21-08-2019
21-08-2019
21-08-2019
21-08-2019
21-08-2019
21-08-2019
21-08-2019
21-08-2019
21-08-2019
09-08-2019
06-08-2019
17-07-2019
17-10-2020
17-10-2020
18-10-2020
19-10-2020
19-10-2020
19-10-2020
19-10-2020
19-10-2020
31-10-2020
31-10-2020
31-10-2020
31-10-2020
31-10-2020
31-10-2020
31-10-2020
31-10-2020
24-10-2020
24-10-2020
24-10-2020
24-10-2020
24-10-2020
24-10-2020
24-10-2020
24-10-2020
24-10-2020
24-10-2020
24-10-2020
24-10-2020
26-10-2020
26-10-2020
26-10-2020
26-10-2020
26-10-2020
26-10-2020
26-10-2020
26-10-2020
26-10-2020
26-10-2020
29-10-2020
29-10-2020
26-10-2020
26-10-2020
26-10-2020
26-10-2020
28-10-2020
28-10-2020
10-10-2020
10-10-2020
10-10-2020
10-10-2020
08-10-2020
08-10-2020
08-10-2020
08-10-2020
11-10-2020
11-10-2020
13-10-2020
13-10-2020
14-10-2020
14-10-2020
17-10-2020
17-10-2020
17-10-2020
16-10-2020
18-10-2020
18-10-2020
04-10-2020
04-10-2020
13-10-2020
13-10-2020
13-10-2020
09-10-2020
13-10-2020
09-10-2020
14-10-2020
14-10-2020
01-10-2020
01-10-2020
01-10-2020
01-10-2020
01-10-2020
01-10-2020
01-10-2020
01-10-2020
01-10-2020
01-10-2020
01-10-2020
01-10-2020
01-10-2020
01-10-2020
01-10-2020
01-10-2020
01-10-2020
01-10-2020
01-10-2020
01-10-2020
01-10-2020
01-10-2020
26-10-2020
27-10-2020
27-10-2020
27-10-2020
27-10-2020
27-10-2020
27-10-2020
27-10-2020
27-10-2020
27-10-2020
27-10-2020
27-10-2020
27-10-2020
27-10-2020
27-10-2020
27-10-2020
27-10-2020
27-10-2020
27-10-2020
27-10-2020
27-10-2020
27-10-2020
27-10-2020
27-10-2020
27-10-2020
27-10-2020
07-10-2020
12-10-2020
10-10-2020
16-10-2020
16-10-2020
15-10-2020
10-09-2020
10-09-2020
10-09-2020
09-03-2020
09-03-2020
11-09-2020
11-09-2020
11-09-2020
27-06-2019
27-06-2019
27-06-2019
27-06-2019
27-06-2019
27-06-2019
27-06-2019
27-06-2019
27-06-2019
27-06-2019
27-06-2019
27-06-2019
27-06-2019
27-06-2019
19-06-2019
19-06-2019
19-06-2019
19-06-2019
19-06-2019
19-06-2019
19-06-2019
19-06-2019
19-06-2019
20-06-2019
20-06-2019
20-06-2019
20-06-2019
20-06-2019
20-06-2019
28-06-2019
28-06-2019
28-06-2019
28-06-2019
28-06-2019
28-06-2019
28-06-2019
28-06-2019
28-06-2019
28-06-2019
28-06-2019
28-06-2019
28-06-2019
28-06-2019
28-06-2019
30-06-2019
30-06-2019
30-06-2019
30-06-2019
30-06-2019
30-06-2019
30-06-2019
30-06-2019
30-06-2019
30-06-2019
30-06-2019
30-06-2019
30-06-2019
30-06-2019
30-06-2019
30-06-2019
30-06-2019
30-06-2019
30-06-2019
30-06-2019
30-06-2019
30-06-2019
30-06-2019
30-06-2019
30-06-2019
30-06-2019
30-06-2019
30-06-2019
30-06-2019
30-06-2019
03-06-2019
03-06-2019
26-06-2019
26-06-2019
26-06-2019
26-06-2019
26-06-2019
27-06-2019
27-06-2019
27-06-2019
27-06-2019
27-06-2019
27-06-2019
27-06-2019
27-06-2019
27-06-2019
27-06-2019
27-06-2019
27-06-2019
27-06-2019
27-06-2019
27-06-2019
27-06-2019
27-06-2019
27-06-2019
27-06-2019
27-06-2019
27-06-2019
27-06-2019
27-06-2019
27-06-2019
27-06-2019
27-06-2019
27-06-2019
27-06-2019
27-06-2019
14-06-2019
14-06-2019
29-06-2019
29-06-2019
29-06-2019
29-06-2019
29-06-2019
29-06-2019
29-06-2019
29-06-2019
29-06-2019
29-06-2019
29-06-2019
30-06-2019
30-06-2019
30-06-2019
30-06-2019
30-06-2019
30-06-2019
30-06-2019
30-06-2019
30-06-2019
30-06-2019
30-06-2019
30-06-2019
21-08-2021
21-08-2021
21-08-2021
21-08-2021
21-08-2021
21-08-2021
21-08-2021
21-08-2021
21-08-2021
21-08-2021
21-08-2021
21-08-2021
21-08-2021
21-08-2021
21-08-2021
21-08-2021
21-08-2021
21-08-2021
21-08-2021
21-08-2021
21-08-2021
21-08-2021
21-08-2021
21-08-2021
21-08-2021
21-08-2021
21-08-2021
21-08-2021
21-08-2021
21-08-2021
21-08-2021
21-08-2021
21-08-2021
21-08-2021
21-08-2021
21-08-2021
21-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
11-08-2021
11-08-2021
11-08-2021
11-08-2021
11-08-2021
11-08-2021
11-08-2021
11-08-2021
11-08-2021
11-08-2021
11-08-2021
11-08-2021
12-08-2021
12-08-2021
12-08-2021
12-08-2021
12-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
18-08-2021
18-08-2021
20-08-2021
20-08-2021
20-08-2021
20-08-2021
20-08-2021
20-08-2021
20-08-2021
20-08-2021
20-08-2021
20-08-2021
20-08-2021
20-08-2021
20-08-2021
20-08-2021
20-08-2021
20-08-2021
20-08-2021
20-08-2021
19-08-2021
19-08-2021
19-08-2021
18-08-2021
18-08-2021
18-08-2021
18-08-2021
18-08-2021
18-08-2021
18-08-2021
18-08-2021
18-08-2021
18-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
19-08-2021
30-11-2019
30-11-2019
30-11-2019
30-11-2019
30-11-2019
30-11-2019
11-11-2019
30-11-2019
27-11-2019
06-11-2019
06-11-2019
06-11-2019
06-11-2019
06-11-2019
06-11-2019
06-11-2019
07-11-2019
07-11-2019
07-11-2019
07-11-2019
07-11-2019
07-11-2019
07-11-2019
08-11-2019
08-11-2019
08-11-2019
08-11-2019
08-11-2019
08-11-2019
08-11-2019
08-11-2019
08-11-2019
11-11-2019
11-11-2019
12-11-2019
12-11-2019
12-11-2019
12-11-2019
30-10-2019
07-11-2019
10-12-2019
10-12-2019
10-12-2019
10-12-2019
10-12-2019
10-12-2019
10-12-2019
10-12-2019
10-12-2019
10-12-2019
10-12-2019
10-12-2019
10-12-2019
10-12-2019
10-12-2019
10-12-2019
10-12-2019
10-12-2019
10-12-2019
10-12-2019
10-12-2019
10-12-2019
10-12-2019
10-12-2019
10-12-2019
10-12-2019
10-12-2019
10-12-2019
10-12-2019
10-12-2019
28-11-2019
28-11-2019
28-11-2019
28-11-2019
28-11-2019
28-11-2019
28-11-2019
04-11-2019
04-11-2019
04-11-2019
04-11-2019
04-11-2019
25-11-2019
25-11-2019
25-11-2019
25-11-2019
25-11-2019
25-11-2019
25-11-2019
25-11-2019
26-11-2019
27-11-2019
27-11-2019
27-11-2019
27-11-2019
27-11-2019
27-11-2019
27-11-2019
27-11-2019
27-11-2019
27-11-2019
27-11-2019
27-11-2019
27-11-2019
27-11-2019
27-11-2019
28-11-2019
03-12-2019
06-11-2019
07-11-2019
07-11-2019
12-11-2019
26-11-2019
28-11-2019
11-11-2019
12-11-2019
12-11-2019
25-11-2019
02-12-2019
13-11-2019
28-11-2019
07-11-2019
07-11-2019
07-11-2019
01-11-2019
01-11-2019
01-11-2019
01-11-2019
01-11-2019
01-11-2019
04-11-2019
04-11-2019
07-11-2019
07-11-2019
25-11-2019
14-03-2019
14-03-2019
20-03-2019
20-03-2019
20-03-2019
20-03-2019
20-03-2019
20-03-2019
20-03-2019
20-03-2019
20-03-2019
18-03-2019
14-03-2019
14-03-2019
14-03-2019
14-03-2019
14-03-2019
14-03-2019
14-03-2019
18-03-2019
18-03-2019
18-03-2019
18-03-2019
14-03-2019
15-03-2019
15-03-2019
15-03-2019
15-03-2019
15-03-2019
15-03-2019
15-03-2019
15-03-2019
15-03-2019
15-03-2019
15-03-2019
15-03-2019
15-03-2019
15-03-2019
15-03-2019
15-03-2019
18-03-2019
01-03-2019
01-03-2019
01-03-2019
07-03-2019
07-03-2019
07-03-2019
07-03-2019
07-03-2019
07-03-2019
18-03-2019
18-03-2019
18-03-2019
22-03-2019
22-03-2019
22-03-2019
22-03-2019
22-03-2019
22-03-2019
22-03-2019
22-03-2019
22-03-2019
22-03-2019
22-03-2019
22-03-2019
22-03-2019
22-03-2019
22-03-2019
22-03-2019
22-03-2019
22-03-2019
22-03-2019
22-03-2019
22-03-2019
22-03-2019
22-03-2019
22-03-2019
22-03-2019
14-03-2019
14-03-2019
14-03-2019
14-03-2019
14-03-2019
19-03-2019
15-01-2019
05-02-2019
20-03-2019
27-12-2018
13-02-2019
13-02-2019
13-02-2019
13-02-2019
29-01-2019
13-11-2018
22-03-2019
12-03-2019
13-02-2019
13-02-2019
17-01-2019
25-03-2019
21-03-2019
21-02-2019
26-03-2019
22-02-2019
22-02-2019
22-02-2019
22-02-2019
07-03-2019
07-03-2019
07-03-2019
07-03-2019
07-03-2019
25-03-2019
07-02-2019
07-02-2019
28-02-2019
28-02-2019
28-02-2019
28-02-2019
28-02-2019
28-02-2019
13-03-2019
13-03-2019
13-03-2019
13-03-2019
13-03-2019
13-03-2019
13-03-2019
13-03-2019
13-03-2019
13-03-2019
13-03-2019
13-03-2019
13-03-2019
13-03-2019
13-03-2019
13-03-2019
13-03-2019
05-07-2019
08-07-2019
08-07-2019
08-07-2019
08-07-2019
08-07-2019
08-07-2019
08-07-2019
08-07-2019
08-07-2019
08-07-2019
08-07-2019
08-07-2019
08-07-2019
08-07-2019
05-07-2019
05-07-2019
05-07-2019
05-07-2019
05-07-2019
05-07-2019
05-07-2019
05-07-2019
05-07-2019
05-07-2019
05-07-2019
11-07-2019
11-07-2019
12-07-2019
12-07-2019
12-07-2019
12-07-2019
12-07-2019
12-07-2019
12-07-2019
12-07-2019
12-07-2019
11-07-2019
11-07-2019
11-07-2019
09-07-2019
11-07-2019
11-07-2019
11-07-2019
11-07-2019
How can I do that?
To solve my problem was necessary a group operation on database, incluse to create 2 temporary tables.
The solution to my case was:
WITH TABLE_X AS (
SELECT P.CD_PESSOA, P.DT_NASCIMENTO_FUNDACAO, TO_DATE(SYSDATE) AS DATA_ATUAL, TO_DATE(G.DT_SOLICITACAO_ATENDIMENTO),
EXTRACT(YEAR FROM SYSDATE) - EXTRACT(YEAR FROM TO_DATE(P.DT_NASCIMENTO_FUNDACAO)) AS IDADE
FROM ATTENDANCE G JOIN PEOPLE P
ON (G.NU_USUARIO = P.CD_PESSOA)
WHERE EXTRACT(YEAR FROM TO_DATE(G.DT_SOLICITACAO_ATENDIMENTO)) >= EXTRACT(YEAR FROM SYSDATE) - 1
AND EXTRACT(YEAR FROM TO_DATE(G.DT_SOLICITACAO_ATENDIMENTO)) <= EXTRACT(YEAR FROM SYSDATE)
ORDER BY IDADE DESC
),
TABLE_Y AS (SELECT
SUM(CASE WHEN IDADE BETWEEN 0 AND 18 THEN 1 ELSE 0 END) AS "0-18",
SUM(CASE WHEN IDADE BETWEEN 19 AND 23 THEN 1 ELSE 0 END) AS "19-23",
SUM(CASE WHEN IDADE BETWEEN 24 AND 28 THEN 1 ELSE 0 END) AS "24-28",
SUM(CASE WHEN IDADE BETWEEN 29 AND 33 THEN 1 ELSE 0 END) AS "29-33",
SUM(CASE WHEN IDADE BETWEEN 34 AND 38 THEN 1 ELSE 0 END) AS "34-38",
SUM(CASE WHEN IDADE BETWEEN 39 AND 43 THEN 1 ELSE 0 END) AS "39-43",
SUM(CASE WHEN IDADE BETWEEN 44 AND 48 THEN 1 ELSE 0 END) AS "44-48",
SUM(CASE WHEN IDADE BETWEEN 49 AND 53 THEN 1 ELSE 0 END) AS "49-53",
SUM(CASE WHEN IDADE BETWEEN 54 AND 58 THEN 1 ELSE 0 END) AS "54-58",
SUM(CASE WHEN IDADE >= 59 THEN 1 ELSE 0 END) AS "59+",
SUM(CASE WHEN IDADE IS NULL THEN 1 ELSE 0 END) AS "VALORES_NULL",
COUNT(IDADE) AS TOTAL_IDADE
FROM TABLE_X
)
SELECT
ROUND(("0-18" / TOTAL_IDADE) * 100, 2) ||'%' AS "0-18",
ROUND(("19-23" / TOTAL_IDADE) * 100, 2) ||'%' AS "19-23",
ROUND(("24-28" / TOTAL_IDADE) * 100, 2) ||'%' AS "24-28",
ROUND(("29-33" / TOTAL_IDADE) * 100, 2) ||'%' AS "29-33",
ROUND(("34-38" / TOTAL_IDADE) * 100, 2) ||'%' AS "29-33",
ROUND(("39-43" / TOTAL_IDADE) * 100, 2) ||'%' AS "34-38",
ROUND(("44-48" / TOTAL_IDADE) * 100, 2) ||'%' AS "44-48",
ROUND(("49-53" / TOTAL_IDADE) * 100, 2) ||'%' AS "49-53",
ROUND(("54-58" / TOTAL_IDADE) * 100, 2) ||'%' AS "54-58",
ROUND(("59+" / TOTAL_IDADE) * 100, 2) ||'%' AS "59+"
FROM TABLE_Y
As result I had:
I am dealing with the word processing ML (Office Word file) using XPath expressions. Due to the nature of bookmarks placed in document, the starting of bookmark may be somewhere else and then the end. So they dont really follow any well formed XML hierarchy, so thats the challenge writing XPath expressions for such bookmarked content to read from document.xml file.
Can someone please help how to handle such unusual XML parsing using XPath? e.g. below table:
<w:p w:rsidR="003A3B76" w:rsidRDefault="003A3B76" w:rsidP="003A3B76">
<w:bookmarkStart w:id="3" w:name="Table3"/>
</w:p>
<w:tbl>
<w:tblPr>
<w:tblStyle w:val="TableGrid"/>
<w:tblW w:w="0" w:type="auto"/>
<w:tblLook w:val="04A0" w:firstRow="1" w:lastRow="0" w:firstColumn="1" w:lastColumn="0" w:noHBand="0" w:noVBand="1"/>
</w:tblPr>
<w:tblGrid>
<w:gridCol w:w="533"/>
<w:gridCol w:w="2148"/>
<w:gridCol w:w="986"/>
<w:gridCol w:w="865"/>
<w:gridCol w:w="4818"/>
</w:tblGrid>
<w:tr w:rsidR="003A3B76" w:rsidTr="005666D2">
<w:tc>
<w:tcPr>
<w:tcW w:w="533" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="BFBFBF" w:themeFill="background1" w:themeFillShade="BF"/>
</w:tcPr>
<w:p w:rsidR="003A3B76" w:rsidRDefault="003A3B76" w:rsidP="005666D2">
<w:r>
<w:t>#</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="2148" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="BFBFBF" w:themeFill="background1" w:themeFillShade="BF"/>
</w:tcPr>
<w:p w:rsidR="003A3B76" w:rsidRDefault="003A3B76" w:rsidP="005666D2">
<w:r>
<w:t>Name</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="986" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="BFBFBF" w:themeFill="background1" w:themeFillShade="BF"/>
</w:tcPr>
<w:p w:rsidR="003A3B76" w:rsidRDefault="003A3B76" w:rsidP="005666D2">
<w:r>
<w:t>Age</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="865" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="BFBFBF" w:themeFill="background1" w:themeFillShade="BF"/>
</w:tcPr>
<w:p w:rsidR="003A3B76" w:rsidRDefault="003A3B76" w:rsidP="005666D2">
<w:r>
<w:t>Weight</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="4818" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="BFBFBF" w:themeFill="background1" w:themeFillShade="BF"/>
</w:tcPr>
<w:p w:rsidR="003A3B76" w:rsidRDefault="003A3B76" w:rsidP="005666D2">
<w:r>
<w:t>Will</w:t>
</w:r>
</w:p>
</w:tc>
</w:tr>
<w:tr w:rsidR="003A3B76" w:rsidTr="005666D2">
<w:tc>
<w:tcPr>
<w:tcW w:w="533" w:type="dxa"/>
</w:tcPr>
<w:p w:rsidR="003A3B76" w:rsidRDefault="003A3B76" w:rsidP="005666D2">
<w:r>
<w:t>2</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="2148" w:type="dxa"/>
</w:tcPr>
<w:p w:rsidR="003A3B76" w:rsidRDefault="003A3B76" w:rsidP="005666D2">
<w:r>
<w:t>Nagraj</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="986" w:type="dxa"/>
</w:tcPr>
<w:p w:rsidR="003A3B76" w:rsidRDefault="003A3B76" w:rsidP="005666D2">
<w:r>
<w:t>38</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="865" w:type="dxa"/>
</w:tcPr>
<w:p w:rsidR="003A3B76" w:rsidRDefault="003A3B76" w:rsidP="005666D2">
<w:r>
<w:t>150lb</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="4818" w:type="dxa"/>
</w:tcPr>
<w:p w:rsidR="003A3B76" w:rsidRDefault="003A3B76" w:rsidP="005666D2">
<w:r>
<w:t>Be real</w:t>
</w:r>
</w:p>
</w:tc>
</w:tr>
<w:bookmarkEnd w:id="3"/>
</w:tbl>
bookmarkEnd is ended here inside table, however not in <tr> or <tc>. and the bookmarkStart is started outside of table. That's the way scenario i have from my tagging. Please help with this. Writing a Xpath expression on this is getting complex, any help with XSLT is also welcome.
I have a flat xml file that needs to be converted to hierarchical. I used the nested grouping idea from here xsl:for-each-group help needed. It's working for the most part except for a couple of issues:
1) The elements root1 and root2 are not showing up.
2) The location of element NFActy is incorrect. The first NFActy should be between the 2 Rot elements.
3) The Duty & NFActy elements are treated as one group for calculating the SequenceCount.
4) For Leg elements each set of Leg elements within one duty should be grouped for SequenceCount for leg elements.
Any help is really appreciated.
Thanks.
Input XML
<root>
<root1>1234</root1>
<root2>5678</root2>
<Schedule>
<a>line 1</a>
<b>line 2</b>
<c>line 3</c>
</Schedule>
<Rot>
<d>line 4</d>
<e>line 5</e>
<f>line 6</f>
<g>line 7</g>
</Rot>
<Duty>
<h>line 8</h>
<i>line 9</i>
<j>line 10</j>
<k>line 11</k>
<l>line 12</l>
</Duty>
<Leg>
<m>line 13</m>
<n>line 14</n>
<o>line 15</o>
</Leg>
<Leg>
<m>line 13</m>
<n>line 14</n>
<o>line 15</o>
</Leg>
<NFActy>
<d>line 214</d>
<e>line 215</e>
<f>line 216</f>
<g>line 217</g>
</NFActy>
<Rot>
<d>line 19</d>
<e>line 20</e>
<f>line 21</f>
<g>line 22</g>
</Rot>
<Duty>
<h>line 23</h>
<i>line 24</i>
<j>line 25</j>
<k>line 26</k>
<l>line 27</l>
</Duty>
<Leg>
<m>line 28</m>
<n>line 29</n>
<o>line 30</o>
</Leg>
<Leg>
<m>line 13</m>
<n>line 14</n>
<o>line 15</o>
</Leg>
<NFActy>
<d>line 224</d>
<e>line 225</e>
<f>line 226</f>
<g>line 227</g>
</NFActy>
Desired Output XML
<root>
<root1>1234</root1>
<root2>5678</root2>
<Schedule>
<a>line 1</a>
<b>line 2</b>
<c>line 3</c>
<Rot>
<d>line 4</d>
<e>line 5</e>
<f>line 6</f>
<g>line 7</g>
<Duty>
<SequenceCount>1</SequenceCount>
<h>line 8</h>
<i>line 9</i>
<j>line 10</j>
<k>line 11</k>
<l>line 12</l>
<Leg>
<SequenceCount>1</SequenceCount>
<m>line 13</m>
<n>line 14</n>
<o>line 15</o>
</Leg>
<Leg>
<SequenceCount>2</SequenceCount>
<m>line 13</m>
<n>line 14</n>
<o>line 15</o>
</Leg>
</Duty>
</Rot>
<NFActy>
<SequenceCount>2</SequenceCount>
<d>line 214</d>
<e>line 215</e>
<f>line 216</f>
<g>line 217</g>
</NFActy>
<Rot>
<d>line 19</d>
<e>line 20</e>
<f>line 21</f>
<g>line 22</g>
<Duty>
<SequenceCount>3</SequenceCount>
<h>line 23</h>
<i>line 24</i>
<j>line 25</j>
<k>line 26</k>
<l>line 27</l>
<Leg>
<SequenceCount>1</SequenceCount>
<m>line 28</m>
<n>line 29</n>
<o>line 30</o>
</Leg>
<Leg>
<SequenceCount>2</SequenceCount>
<m>line 13</m>
<n>line 14</n>
<o>line 15</o>
/Leg>
</Duty>
</Rot>
<NFActy>
<SequenceCount>4</SequenceCount>
<d>line 224</d>
<e>line 225</e>
<f>line 226</f>
<g>line 227</g>
</NFActy>
</Schedule>
My XSL
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fn="fn" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="2.0"
exclude-result-prefixes="xs fn">
<xsl:output indent="yes" />
<xsl:template match="/">
<xsl:for-each-group select="*" group-starting-with="root">
<root>
<xsl:for-each-group select="*" group-starting-with="*[name(.)='Schedule']">
<xsl:choose>
<xsl:when test="name(.)='Schedule'">
<Schedule>
<xsl:apply-templates />
<xsl:for-each-group select="current-group()" group-starting-with="*[name(.)='Rot']">
<xsl:choose>
<xsl:when test="name(.)='Rot'">
<Rot>
<xsl:apply-templates />
<xsl:for-each-group select="current-group()" group-starting-with="*[name(.)='Duty']">
<xsl:choose>
<xsl:when test="name(.)='Duty'">
<Duty>
<xsl:element name="SequenceCount"><xsl:number count="Duty|NFActy" level="any"/></xsl:element>
<xsl:apply-templates />
<xsl:for-each-group select="current-group()" group-starting-with="*[name(.)='Leg']">
<xsl:choose>
<xsl:when test="name(.)='Leg'">
<Leg>
<xsl:element name="SequenceCount"><xsl:number value="position() - 1"/></xsl:element>
<xsl:apply-templates />
</Leg>
</xsl:when>
</xsl:choose>
</xsl:for-each-group>
</Duty>
</xsl:when>
</xsl:choose>
</xsl:for-each-group>
</Rot>
</xsl:when>
</xsl:choose>
</xsl:for-each-group>
<xsl:for-each-group select="current-group()" group-starting-with="*[name(.)='NFActy']">
<xsl:choose>
<xsl:when test="name(.)='NFActy'">
<NFActy>
<xsl:element name="SequenceCount"><xsl:number count="Duty|NFActy" level="any"/></xsl:element>
<xsl:apply-templates />
</NFActy>
</xsl:when>
</xsl:choose>
</xsl:for-each-group>
</Schedule>
</xsl:when>
</xsl:choose>
</xsl:for-each-group>
</root>
</xsl:for-each-group>
</xsl:template>
<xsl:template match="node()">
<xsl:copy>
<xsl:apply-templates select="node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Here is my edit of your code, you need to make sure you process all elements at the same time and not as you had with sequential for-each-group.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" version="2.0"
exclude-result-prefixes="xs">
<xsl:output indent="yes" />
<xsl:template match="root">
<xsl:copy>
<xsl:for-each-group select="*" group-starting-with="Schedule">
<xsl:choose>
<xsl:when test="self::Schedule">
<Schedule>
<xsl:apply-templates />
<xsl:for-each-group select="current-group() except ." group-starting-with="Rot | NFActy">
<xsl:choose>
<xsl:when test="self::Rot | self::NFActy">
<xsl:copy>
<xsl:if test="self::NFActy">
<SequenceCount><xsl:number count="Duty | NFActy" level="any"/></SequenceCount>
</xsl:if>
<xsl:apply-templates />
<xsl:for-each-group select="current-group() except ." group-starting-with="Duty">
<xsl:choose>
<xsl:when test="self::Duty">
<xsl:copy>
<SequenceCount><xsl:number count="Duty | NFActy" level="any"/></SequenceCount>
<xsl:apply-templates />
<xsl:for-each-group select="current-group() except ." group-starting-with="Leg">
<xsl:choose>
<xsl:when test="self::Leg">
<Leg>
<SequenceCount><xsl:number value="position()"/></SequenceCount>
<xsl:apply-templates />
</Leg>
</xsl:when>
</xsl:choose>
</xsl:for-each-group>
</xsl:copy>
</xsl:when>
</xsl:choose>
</xsl:for-each-group>
</xsl:copy>
</xsl:when>
</xsl:choose>
</xsl:for-each-group>
</Schedule>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="current-group()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each-group>
</xsl:copy>
</xsl:template>
<xsl:template match="node()">
<xsl:copy>
<xsl:apply-templates select="node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
When I apply above stylesheet with Saxon 9.5 to the input
<root>
<root1>1234</root1>
<root2>5678</root2>
<Schedule>
<a>line 1</a>
<b>line 2</b>
<c>line 3</c>
</Schedule>
<Rot>
<d>line 4</d>
<e>line 5</e>
<f>line 6</f>
<g>line 7</g>
</Rot>
<Duty>
<h>line 8</h>
<i>line 9</i>
<j>line 10</j>
<k>line 11</k>
<l>line 12</l>
</Duty>
<Leg>
<m>line 13</m>
<n>line 14</n>
<o>line 15</o>
</Leg>
<Leg>
<m>line 13</m>
<n>line 14</n>
<o>line 15</o>
</Leg>
<NFActy>
<d>line 214</d>
<e>line 215</e>
<f>line 216</f>
<g>line 217</g>
</NFActy>
<Rot>
<d>line 19</d>
<e>line 20</e>
<f>line 21</f>
<g>line 22</g>
</Rot>
<Duty>
<h>line 23</h>
<i>line 24</i>
<j>line 25</j>
<k>line 26</k>
<l>line 27</l>
</Duty>
<Leg>
<m>line 28</m>
<n>line 29</n>
<o>line 30</o>
</Leg>
<Leg>
<m>line 13</m>
<n>line 14</n>
<o>line 15</o>
</Leg>
<NFActy>
<d>line 224</d>
<e>line 225</e>
<f>line 226</f>
<g>line 227</g>
</NFActy>
</root>
I get the result
<root>
<root1>1234</root1>
<root2>5678</root2>
<Schedule>
<a>line 1</a>
<b>line 2</b>
<c>line 3</c>
<Rot>
<d>line 4</d>
<e>line 5</e>
<f>line 6</f>
<g>line 7</g>
<Duty>
<SequenceCount>1</SequenceCount>
<h>line 8</h>
<i>line 9</i>
<j>line 10</j>
<k>line 11</k>
<l>line 12</l>
<Leg>
<SequenceCount>1</SequenceCount>
<m>line 13</m>
<n>line 14</n>
<o>line 15</o>
</Leg>
<Leg>
<SequenceCount>2</SequenceCount>
<m>line 13</m>
<n>line 14</n>
<o>line 15</o>
</Leg>
</Duty>
</Rot>
<NFActy>
<SequenceCount>2</SequenceCount>
<d>line 214</d>
<e>line 215</e>
<f>line 216</f>
<g>line 217</g>
</NFActy>
<Rot>
<d>line 19</d>
<e>line 20</e>
<f>line 21</f>
<g>line 22</g>
<Duty>
<SequenceCount>3</SequenceCount>
<h>line 23</h>
<i>line 24</i>
<j>line 25</j>
<k>line 26</k>
<l>line 27</l>
<Leg>
<SequenceCount>1</SequenceCount>
<m>line 28</m>
<n>line 29</n>
<o>line 30</o>
</Leg>
<Leg>
<SequenceCount>2</SequenceCount>
<m>line 13</m>
<n>line 14</n>
<o>line 15</o>
</Leg>
</Duty>
</Rot>
<NFActy>
<SequenceCount>4</SequenceCount>
<d>line 224</d>
<e>line 225</e>
<f>line 226</f>
<g>line 227</g>
</NFActy>
</Schedule>
</root>
I am creating a SLD for Geoserver wms layer. The SLD validates without error but the icons will not show in the map. I am using attribute based rules to compare strings to have the correct image show for the correct feature. Here is my code and thanks for any help!
<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd"
xmlns="http://www.opengis.net/sld"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<NamedLayer>
<Name>Upper Shore Image Points</Name>
<UserStyle>
<Title>Vendor Points</Title>
<FeatureTypeStyle>
<Rule>
<Name>Famers Market</Name>
<Title>All Farmers Markets</Title>
<ogc:Filter>
<ogc:PropertyIsLike wildCard="*" singleChar="." escape="!">
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:Literal>farmers maket vendor</ogc:Literal>
</ogc:PropertyIsLike>
</ogc:Filter>
<PointSymbolizer>
<Graphic>
<ExternalGraphic>
<OnlineResource
xlink:type="simple"
xlink:href="Farmers Markets.jpg" />
<Format>image/jpeg</Format>
</ExternalGraphic>
<Size>32</Size>
</Graphic>
</PointSymbolizer>
</Rule>
<Rule>
<Name>Fruit and Vegetable</Name>
<Title>All Fruit and Vegetable</Title>
<ogc:Filter>
<ogc:PropertyIsLike wildCard="*" singleChar="." escape="!">
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:Literal>Fruit and Vegetable Farm</ogc:Literal>
</ogc:PropertyIsLike>
</ogc:Filter>
<PointSymbolizer>
<Graphic>
<ExternalGraphic>
<OnlineResource
xlink:type="simple"
xlink:href="Fruit and Vegetable Farms.jpg" />
<Format>image/jpeg</Format>
</ExternalGraphic>
<Size>32</Size>
</Graphic>
</PointSymbolizer>
</Rule>
<Rule>
<Name>Horse Stable</Name>
<Title>All Horse Stables</Title>
<ogc:Filter>
<ogc:PropertyIsLike wildCard="*" singleChar="." escape="!">
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:Literal>Horse Stable</ogc:Literal>
</ogc:PropertyIsLike>
</ogc:Filter>
<PointSymbolizer>
<Graphic>
<ExternalGraphic>
<OnlineResource
xlink:type="simple"
xlink:href="Horse Stable.jpg" />
<Format>image/jpeg</Format>
</ExternalGraphic>
<Size>32</Size>
</Graphic>
</PointSymbolizer>
</Rule>
<Rule>
<Name>Wool Products</Name>
<Title>All Wool Products</Title>
<ogc:Filter>
<ogc:PropertyIsLike wildCard="*" singleChar="." escape="!">
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:Literal>Wool Products</ogc:Literal>
</ogc:PropertyIsLike>
</ogc:Filter>
<PointSymbolizer>
<Graphic>
<ExternalGraphic>
<OnlineResource
xlink:type="simple"
xlink:href="Wool Products.jpg" />
<Format>image/jpeg</Format>
</ExternalGraphic>
<Size>32</Size>
</Graphic>
</PointSymbolizer>
</Rule>
<Rule>
<Name>Restaurant</Name>
<Title>All Restaurants</Title>
<ogc:Filter>
<ogc:PropertyIsLike wildCard="*" singleChar="." escape="!">
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:Literal>Restaurant</ogc:Literal>
</ogc:PropertyIsLike>
</ogc:Filter>
<PointSymbolizer>
<Graphic>
<ExternalGraphic>
<OnlineResource
xlink:type="simple"
xlink:href="Restaurant.jpg" />
<Format>image/jpeg</Format>
</ExternalGraphic>
<Size>32</Size>
</Graphic>
</PointSymbolizer>
</Rule>
<Rule>
<Name>Coffee Roasting</Name>
<Title>All Coffee Roasting</Title>
<ogc:Filter>
<ogc:PropertyIsLike wildCard="*" singleChar="." escape="!">
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:Literal>Coffee Roasting</ogc:Literal>
</ogc:PropertyIsLike>
</ogc:Filter>
<PointSymbolizer>
<Graphic>
<ExternalGraphic>
<OnlineResource
xlink:type="simple"
xlink:href="Coffee Roasting.jpg" />
<Format>image/jpeg</Format>
</ExternalGraphic>
<Size>32</Size>
</Graphic>
</PointSymbolizer>
</Rule>
<Rule>
<Name>Charter Service</Name>
<Title>All Charter Services</Title>
<ogc:Filter>
<ogc:PropertyIsLike wildCard="*" singleChar="." escape="!">
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:Literal>Charter Service</ogc:Literal>
</ogc:PropertyIsLike>
</ogc:Filter>
<PointSymbolizer>
<Graphic>
<ExternalGraphic>
<OnlineResource
xlink:type="simple"
xlink:href="Charter Service.jpg" />
<Format>image/jpeg</Format>
</ExternalGraphic>
<Size>32</Size>
</Graphic>
</PointSymbolizer>
</Rule>
<Rule>
<Name>Apiary</Name>
<Title>All Apiaries</Title>
<ogc:Filter>
<ogc:PropertyIsLike wildCard="*" singleChar="." escape="!">
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:Literal>Apiary</ogc:Literal>
</ogc:PropertyIsLike>
</ogc:Filter>
<PointSymbolizer>
<Graphic>
<ExternalGraphic>
<OnlineResource
xlink:type="simple"
xlink:href="Apiary.jpg" />
<Format>image/jpeg</Format>
</ExternalGraphic>
<Size>32</Size>
</Graphic>
</PointSymbolizer>
</Rule>
<Rule>
<Name>Vineyard</Name>
<Title>All Vineyards</Title>
<ogc:Filter>
<ogc:PropertyIsLike wildCard="*" singleChar="." escape="!">
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:Literal>Vineyard</ogc:Literal>
</ogc:PropertyIsLike>
</ogc:Filter>
<PointSymbolizer>
<Graphic>
<ExternalGraphic>
<OnlineResource
xlink:type="simple"
xlink:href="Vineyard.jpg" />
<Format>image/jpeg</Format>
</ExternalGraphic>
<Size>32</Size>
</Graphic>
</PointSymbolizer>
</Rule>
<Rule>
<Name>Retail Seafood</Name>
<Title>All Retail Seafood</Title>
<ogc:Filter>
<ogc:PropertyIsLike wildCard="*" singleChar="." escape="!">
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:Literal>Retail Seafood</ogc:Literal>
</ogc:PropertyIsLike>
</ogc:Filter>
<PointSymbolizer>
<Graphic>
<ExternalGraphic>
<OnlineResource
xlink:type="simple"
xlink:href="Retail Seafood.jpg" />
<Format>image/jpeg</Format>
</ExternalGraphic>
<Size>32</Size>
</Graphic>
</PointSymbolizer>
</Rule>
<Rule>
<Name>Bakery</Name>
<Title>All Bakeries</Title>
<ogc:Filter>
<ogc:PropertyIsLike wildCard="*" singleChar="." escape="!">
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:Literal>Bakery</ogc:Literal>
</ogc:PropertyIsLike>
</ogc:Filter>
<PointSymbolizer>
<Graphic>
<ExternalGraphic>
<OnlineResource
xlink:type="simple"
xlink:href="Bakery.jpg" />
<Format>image/jpeg</Format>
</ExternalGraphic>
<Size>32</Size>
</Graphic>
</PointSymbolizer>
</Rule>
<Rule>
<Name>Dairy/Eggs</Name>
<Title>All Dairy/ Eggs</Title>
<ogc:Filter>
<ogc:PropertyIsLike wildCard="*" singleChar="." escape="!">
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:Literal>Dairy/Eggs</ogc:Literal>
</ogc:PropertyIsLike>
</ogc:Filter>
<PointSymbolizer>
<Graphic>
<ExternalGraphic>
<OnlineResource
xlink:type="simple"
xlink:href="Dairy_Eggs.jpg" />
<Format>image/jpeg</Format>
</ExternalGraphic>
<Size>32</Size>
</Graphic>
</PointSymbolizer>
</Rule>
<Rule>
<Name>Christmas Tree Farm</Name>
<Title>All Christmas Tree Farms</Title>
<ogc:Filter>
<ogc:PropertyIsLike wildCard="*" singleChar="." escape="!">
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:Literal>Christmas Tree Farm</ogc:Literal>
</ogc:PropertyIsLike>
</ogc:Filter>
<PointSymbolizer>
<Graphic>
<ExternalGraphic>
<OnlineResource
xlink:type="simple"
xlink:href="Christmas Tree Farm.jpg" />
<Format>image/jpeg</Format>
</ExternalGraphic>
<Size>32</Size>
</Graphic>
</PointSymbolizer>
</Rule>
<Rule>
<Name>Grains</Name>
<Title>All Grain Farms</Title>
<ogc:Filter>
<ogc:PropertyIsLike wildCard="*" singleChar="." escape="!">
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:Literal>Grains</ogc:Literal>
</ogc:PropertyIsLike>
</ogc:Filter>
<PointSymbolizer>
<Graphic>
<ExternalGraphic>
<OnlineResource
xlink:type="simple"
xlink:href="Grains.jpg" />
<Format>image/jpeg</Format>
</ExternalGraphic>
<Size>32</Size>
</Graphic>
</PointSymbolizer>
</Rule>
<Rule>
<Name>Meat Products</Name>
<Title>All Meat Products</Title>
<ogc:Filter>
<ogc:PropertyIsLike wildCard="*" singleChar="." escape="!">
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:Literal>Meat Products</ogc:Literal>
</ogc:PropertyIsLike>
</ogc:Filter>
<PointSymbolizer>
<Graphic>
<ExternalGraphic>
<OnlineResource
xlink:type="simple"
xlink:href="Meat.jpg" />
<Format>image/jpeg</Format>
</ExternalGraphic>
<Size>32</Size>
</Graphic>
</PointSymbolizer>
</Rule>
<Rule>
<Name>Nursery</Name>
<Title>All Nurseries</Title>
<ogc:Filter>
<ogc:PropertyIsLike wildCard="*" singleChar="." escape="!">
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:Literal>Nursery</ogc:Literal>
</ogc:PropertyIsLike>
</ogc:Filter>
<PointSymbolizer>
<Graphic>
<ExternalGraphic>
<OnlineResource
xlink:type="simple"
xlink:href="Nursery.jpg" />
<Format>image/jpeg</Format>
</ExternalGraphic>
<Size>32</Size>
</Graphic>
</PointSymbolizer>
</Rule>
<Rule>
<Name>Petting Zoo</Name>
<Title>All Petting Zoos</Title>
<ogc:Filter>
<ogc:PropertyIsLike wildCard="*" singleChar="." escape="!">
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:Literal>Petting Zoo</ogc:Literal>
</ogc:PropertyIsLike>
</ogc:Filter>
<PointSymbolizer>
<Graphic>
<ExternalGraphic>
<OnlineResource
xlink:type="simple"
xlink:href="Petting Zoo.jpg" />
<Format>image/jpeg</Format>
</ExternalGraphic>
<Size>32</Size>
</Graphic>
</PointSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
I realize this post is old but maybe someone will benefit from my answer.
I didn't succeed in using relative image paths so I turned to using URL paths.
Put image(s) in $GEOSERVER_DATA_DIR/styles and reference it with http://localhost:8081/geoserver/styles/some_image.png
For example
<ExternalGraphic>
<OnlineResource xlink:type="simple" xlink:href="http://localhost:8081/geoserver/styles/some_image.png"/>
<Format>image/png</Format>
</ExternalGraphic>
Nice answer, but you need to change the 8081 to 8080 assuming the geoserver instance is working on port 8080
you can put your image in style folder
I've try to migrate my ASP.NET MVC 3 project (with CodeFirst) to Windows Azure. Offcurse I changed the Providers.I've check the azure sql db and there are new tables like: Applications, Memberships, Profiles,Roles,Users
but now I got error:
[SqlException (0x80131904): Invalid column name 'ApplicationId'.
Invalid column name 'UserName'.
Invalid column name 'UserId'.
Invalid column name 'ApplicationId'.
Invalid column name 'UserName'.
Invalid column name 'IsAnonymous'.
Invalid column name 'LastActivityDate'.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +2091750
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +5103168
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +260
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2294
System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +33
System.Data.SqlClient.SqlDataReader.get_MetaData() +86
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +311
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +987
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +141
System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +12
System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior) +10
System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior) +443
[EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details.]
System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior) +479
System.Data.Objects.Internal.ObjectQueryExecutionPlan.Execute(ObjectContext context, ObjectParameterCollection parameterValues) +736
System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) +149
System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator() +44
System.Linq.Enumerable.FirstOrDefault(IEnumerable`1 source) +182
System.Data.Objects.ELinq.ObjectQueryProvider.<GetElementFunction>b__1(IEnumerable`1 sequence) +41
System.Data.Objects.ELinq.ObjectQueryProvider.ExecuteSingle(IEnumerable`1 query, Expression queryRoot) +59
System.Data.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute(Expression expression) +150
System.Data.Entity.Internal.Linq.DbQueryProvider.Execute(Expression expression) +87
System.Linq.Queryable.FirstOrDefault(IQueryable`1 source) +265
System.Web.Providers.QueryHelper.GetUser(MembershipContext ctx, String userName, String applicationName) +2104
System.Web.Providers.DefaultMembershipProvider.Membership_CreateUser(String applicationName, String userName, String password, String salt, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, DateTime& createDate, Boolean uniqueEmail, Int32 passwordFormat, Object& providerUserKey) +151
System.Web.Providers.DefaultMembershipProvider.CreateUser(String username, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, Object providerUserKey, MembershipCreateStatus& status) +836
System.Web.Security.Membership.CreateUser(String username, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, Object providerUserKey, MembershipCreateStatus& status) +207
GameiDemo.Controllers.HomeController.Index(User model) +99
lambda_method(Closure , ControllerBase , Object[] ) +108
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +208
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +55
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +263
System.Web.Mvc.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14() +19
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +191
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +343
System.Web.Mvc.Controller.ExecuteCore() +116
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +97
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +37
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21
System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +50
System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7
System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8969201
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184
Web.config:
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=152368
-->
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<connectionStrings>
<!--
<add name="ApplicationServices"
connectionString="data source=mssql01\sql01;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"
providerName="System.Data.SqlClient" />
-->
<!--<add name="ApplicationServices" connectionString="Server=tcp:...database.windows.net,1433;Database=...;User ID=...#...;Password={your_password_here};Trusted_Connection=False;Encrypt=True;Connection Timeout=30;" providerName="System.Data.SqlClient" />-->
<!--<add name="DBConnection" connectionString="Server=tcp:....database.windows.net,1433;Database=...;User ID=...#...;Password={your_password_here};Trusted_Connection=False;Encrypt=True;Connection Timeout=30;" providerName="System.Data.SqlClient" />/-->
<!--
<add name="DBConnection" connectionString="data source=.\SQLEXPRESS;initial catalog=GameiDemo;integrated security=True;multipleactiveresultsets=True;" providerName="System.Data.SqlClient" />
-->
<!--<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"
providerName="System.Data.SqlClient" />//-->
<add name="DefaultConnection" providerName="System.Data.SqlClient"
connectionString="Data Source=tcp:....database.windows.net,1433;Initial Catalog=gamei_db;User Id=...#...;Password=123aba321!;Trusted_Connection=False;Encrypt=True;Connection Timeout=130;**MultipleActiveResultSets=True**" />
</connectionStrings>
<appSettings>
<add key="webpages:Version" value="1.0.0.0" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="2880" />
</authentication>
<membership defaultProvider="DefaultMembershipProvider">
<providers>
<clear />
<!-- <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" /> //-->
<add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
</providers>
</membership>
<profile defaultProvider="DefaultProfileProvider">
<providers>
<clear />
<!-- <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" /> //-->
<add name="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
</providers>
</profile>
<roleManager enabled="false" defaultProvider="DefaultRoleProvider">
<providers>
<clear />
<!--<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />-->
<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
<add name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
</providers>
</roleManager>
<pages>
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
</namespaces>
</pages>
<sessionState mode="InProc" customProvider="DefaultSessionProvider">
<providers>
<add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" />
</providers>
</sessionState>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.web>
<customErrors mode="Off" />
</system.web>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
</entityFramework>
</configuration>
I change username and serwer adres with "..." :)
I found what was wrong. One table form my model was named Users -> this cause that User table from System.Web.Providers does create.