Mam zawartość HTML w moim XML. Wcześniej mogłem po prostu użyć <xsl:copy-of select="customFields/customField[@name='mainContent']/html"/>
, aby przenieść zawartość do właściwego obszaru. Nowym wymogiem jest zamiana pierwszego <tr>
w każdym z tabel <tbody>
w zestaw thead/tr/th
.Konwersja pierwszego wiersza tabeli HTML do wiersza nagłówka dla każdej tabeli przy użyciu XSLT
jestem mylić w jaki sposób przekonwertować, w rzeczywistości nawet nie brzeg czego zacząć:
...
<customField name="mainContent" type="Html">
<html>
<h1>Page Heading</h1>
<p>Gusto te minim tempor elit quam. Dolore vel accumsan parum option me. Demonstraverunt congue nisl soluta tincidunt seacula. Soluta saepius demonstraverunt praesent claritatem mutationem. Modo te ullamcorper vel augue veniam. Nunc investigationes dolor iriure typi in.</p>
<p>Gusto te minim tempor elit quam. Dolore vel accumsan parum option me. Demonstraverunt congue nisl soluta tincidunt seacula. Soluta saepius demonstraverunt praesent claritatem mutationem. Modo te ullamcorper vel augue veniam. Nunc investigationes dolor iriure typi in.</p>
<table cellspacing="0" cellpadding="0" summary="" border="0">
<tbody>
<tr>
<td>Heading 1</td>
<td>Heading 2</td>
<td>Heading 3</td>
</tr>
<tr>
<td>sample</td>
<td>sample</td>
<td>sample</td>
</tr>
<tr>
<td>sample</td>
<td>sample</td>
<td>sample</td>
</tr>
<tr>
<td>sample</td>
<td>sample</td>
<td>sample</td>
</tr>
<tr>
<td>sample</td>
<td>sample</td>
<td>sample</td>
</tr>
</tbody>
</table>
</html>
</customField>
...
do:
...
<customField name="mainContent" type="Html">
<html>
<h1>Page Heading</h1>
<p>Gusto te minim tempor elit quam. Dolore vel accumsan parum option me. Demonstraverunt congue nisl soluta tincidunt seacula. Soluta saepius demonstraverunt praesent claritatem mutationem. Modo te ullamcorper vel augue veniam. Nunc investigationes dolor iriure typi in.</p>
<p>Gusto te minim tempor elit quam. Dolore vel accumsan parum option me. Demonstraverunt congue nisl soluta tincidunt seacula. Soluta saepius demonstraverunt praesent claritatem mutationem. Modo te ullamcorper vel augue veniam. Nunc investigationes dolor iriure typi in.</p>
<table cellspacing="0" cellpadding="0" summary="" border="0">
<thead>
<tr>
<th>Heading 1</th>
<th>Heading 2</th>
<th>Heading 3</th>
</tr>
</thead>
<tbody>
<tr>
<td>sample</td>
<td>sample</td>
<td>sample</td>
</tr>
<tr>
<td>sample</td>
<td>sample</td>
<td>sample</td>
</tr>
<tr>
<td>sample</td>
<td>sample</td>
<td>sample</td>
</tr>
<tr>
<td>sample</td>
<td>sample</td>
<td>sample</td>
</tr>
</tbody>
</table>
</html>
</customField>
...
Dobre pytanie, +1. Zobacz moją odpowiedź na kompletne i krótkie rozwiązanie, korzystając z najbardziej podstawowego i potężnego wzorca projektowego XSLT - nadrzędnej reguły tożsamości. –