Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Sep 5, 2019. It is now read-only.

Commit a5d744f

Browse files
Vide 3
-Esempio finale -fine slide 3
1 parent 4d27772 commit a5d744f

File tree

3 files changed

+49
-17
lines changed

3 files changed

+49
-17
lines changed

‎02 - XML.md

Lines changed: 49 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,22 +1089,54 @@ Più in particolare in ingresso si ha un .xml file (1), il quale passa attravers
10891089
### Esempio di XSLT
10901090

10911091
```xml
1092-
<?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/">
1093-
<html>
1094-
<head><link rel="stylesheet" href="style.css"/></head> <body>
1095-
<h2>My Articles</h2>
1096-
<table>
1097-
<tr>
1098-
<th>Title</th>
1099-
</tr>
1100-
<xsl:for-each select="bibliography/article">
1101-
<tr>
1102-
<td><xsl:value-of select="title"/></td>
1103-
</tr>
1104-
</xsl:for-each>
1105-
</table>
1106-
</body></html>
1107-
</xsl:template>
1108-
</xsl:stylesheet>
1092+
01<?xml version="1.0" encoding="ISO-8859-1"?>
1093+
02 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
1094+
03 <xsl:template match="/">
1095+
04 <html>
1096+
05 <head><link rel="stylesheet" href="style.css"/></head> <body>
1097+
06 <h2>My Articles</h2>
1098+
07 <table>
1099+
08 <tr>
1100+
09 <th>Title</th>
1101+
10 </tr>
1102+
11 <xsl:for-each select="bibliography/article">
1103+
12 <tr>
1104+
13 <td><xsl:value-of select="title"/></td>
1105+
14 </tr>
1106+
15 </xsl:for-each>
1107+
16 </table>
1108+
17 </body></html>
1109+
18 </xsl:template>
1110+
19 </xsl:stylesheet>
11091111
```
11101112

1113+
1114+
1115+
1116+
1117+
- `<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/">`denominato come `name space`.
1118+
- la radice del documento è `</xsl:stylesheet>`.
1119+
- In questo esempio c'è una singola regola cha va dalla riga 03 alla riga 18 denominata `template`.
1120+
- `match="/"` per il matching della regola.
1121+
- Dalla riga 04 alla riga 17 si ha il template della pagina htlm. All'interno di queste righe si hanno altri tags che specificano altre cose per XLST processor. Ad esempio alla riga 11 si ha:
1122+
`<xsl:for-each select="bibliography/article">` che significa che per ogni `article` che si trova sotto a `bibliography` viene applicata una regola. Il tutto si trova dentro ad una tabella come viene indicato alla riga 07. Quindi se si ha una tabella nel file di input le righe veranno generate automaticamente insieme alla seguente istruzione:
1123+
`<xsl:value-of select="title"/>`
1124+
1125+
1126+
1127+
**Esempio**:
1128+
1129+
Prodotto finale:
1130+
1131+
![32](immagini/lezione-02/32.png)
1132+
1133+
1134+
1135+
Codice che genera il prodotto finale:
1136+
1137+
![33](immagini/lezione-02/33.png)
1138+
1139+
1) Dove viene "linkato" il file stylesheet. Se si rimuove questa riga si ottine un prodotto finale senza stile.
1140+
1141+
Quindi si vede come questo file passa attraverso XSLT file (visto prima) e come a questo file vengano tolte delle informazioni e vengono mantenute altre. Più in particolare dalla tabella viene mantenuto solo il titolo.
1142+

‎immagini/lezione-02/32.png

117 KB
Loading[フレーム]

‎immagini/lezione-02/33.png

250 KB
Loading[フレーム]

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /