XSLT 2.0 group-by: grouping/w processing of text node
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 13
- Joined: Wed Nov 02, 2005 1:39 am
XSLT 2.0 group-by: grouping/w processing of text node
Hello,
I'm new to the XSLT 2.0 "group-by" method and was wondering whether someone could help me with the following task.
I have XML code that's structured like this:
This code is to be transformed into LaTeX source code for typesetting.
The transformation is to achieve:
1) output text content of <lem>-element
2) group <rdg> elements on the basis of their text content. In the above example, the result should be "dhīr nirviṣayā Pr-A, M-A; \underline{dhīr} ni\underline{r}viṣayā Pr-B".
2) Further conditional processing of <rdg> elements on the basis of attribute values. If the attribute "type" has the value "edition", the value of the attribute "wit" is to be enclosed in brackets, i.e. the above example should actually be ""dhīr nirviṣayā Pr-A, M-A (Pr-2); \underline{dhīr} ni\underline{r}viṣayā Pr-B".
The text content of the rdg-element can contain further nodes that require processing, like, in this example, <unclear> that should be transformed into underlined text.
I was thus far able to perform the basic grouping operation, but I'm not sure how to call templates for further sub-processing of the grouped nodes, nor how to apply further conditions on <rdg>-attributes.
I'd very much appreciate advice.
Thanks in advance, [/list]
I'm new to the XSLT 2.0 "group-by" method and was wondering whether someone could help me with the following task.
I have XML code that's structured like this:
Code: Select all
<app type="critical">
<lem>dhīr nirviṣayā </lem>
<rdg varSeq="1" wit="M-A" type="witness-pratika">dhīr nirviṣayā</rdg>
<rdg varSeq="1" wit="Pr-A">dhīr nirviṣayā</rdg>
<rdg varSeq="2" wit="Pr-B"><unclear reason="out-of-focus">dhīr</unclear> ni<unclear reason="out-of-focus">r</unclear>viṣayā </rdg>
<rdg type="edition" varSeq="1" wit="Pr-2">dhīr nirviṣayā</rdg>
</app>
The transformation is to achieve:
1) output text content of <lem>-element
2) group <rdg> elements on the basis of their text content. In the above example, the result should be "dhīr nirviṣayā Pr-A, M-A; \underline{dhīr} ni\underline{r}viṣayā Pr-B".
2) Further conditional processing of <rdg> elements on the basis of attribute values. If the attribute "type" has the value "edition", the value of the attribute "wit" is to be enclosed in brackets, i.e. the above example should actually be ""dhīr nirviṣayā Pr-A, M-A (Pr-2); \underline{dhīr} ni\underline{r}viṣayā Pr-B".
The text content of the rdg-element can contain further nodes that require processing, like, in this example, <unclear> that should be transformed into underlined text.
I was thus far able to perform the basic grouping operation, but I'm not sure how to call templates for further sub-processing of the grouped nodes, nor how to apply further conditions on <rdg>-attributes.
Code: Select all
<xsl:template match="note/app">
<xsl:choose>
<xsl:when test="@type = 'critical'"><xsl:for-each select="child::lem">{\lemma{<xsl:apply-templates/>}</xsl:for-each>{\Afootnote{<xsl:for-each-group select="rdg" group-by="."><xsl:sort select="@varSeq"/>
<xsl:copy-of select="current-grouping-key( )"/>&space;
<xsl:value-of select="current-group()/@wit" separator=", "/>; </xsl:for-each-group>}}} </xsl:when>
</xsl:choose>
</xsl:template>
Thanks in advance, [/list]
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: XSLT 2.0 group-by: grouping/w processing of text node
Post by sorin_ristache »
Hello,
Regards,
Sorin
I think you can receive more useful answers if you post an example of the output file.kellner wrote:This code is to be transformed into LaTeX source code for typesetting.
The transformation is to achieve:
Regards,
Sorin
-
- Posts: 13
- Joined: Wed Nov 02, 2005 1:39 am
Ok, here's a sample of the LaTeX file:
Code: Select all
\documentclass[a4paper,twoside,10pt]{book}
\usepackage[cjkjis]{ucs}
\usepackage[german]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{fancyhdr}
\usepackage{setspace}
\usepackage{titlesec}
\usepackage{ledmac}
\usepackage{multibbl}
\usepackage{ulem} \onehalfspacing \PrerenderUnicode{ñ} \titleformat*{\section}{\sc}
\titleformat*{\subsection}{\sc} \setlength{\parindent}{12pt} \setlength{\headheight}{15pt}
\usepackage[left=2cm, right=8cm, top=5cm, bottom=5cm]{geometry} \pagestyle{fancy}
\fancyhead{} \fancyfoot{} \fancyfoot[CE,CO]{\today} \setlength{\stanzaindentbase}{12pt}
\setstanzaindents{1,1,1} \setstanzapenalties{1,5000,5000,5000} \let\endstanzaextra=\medbreak
\footparagraph{A} \footparagraph{B} \footparagraph{C} \footparagraph{D}
\renewcommand{\notenumfont}{\bfseries}\renewcommand*{\notefontsetup}{%
\def\baselinestretch{1.0}% \footnotesize}
\begin{document}
\lineation{page} \linenummargin{inner}
\firstlinenum{0} \linenumincrement{5} \beginnumbering
\pstart
\textbf{451}
\par
\edtext{atha}{\lemma{atha}{\Afootnote{
atha Pr-A, Pr-B (Pr-2); }}} notpadyate tasmān na ca \edtext{tatpratibhāsinī}{\lemma{tatpratibhāsinī}{\Afootnote{
tatpratibhāsinī Pr-A, Pr-B (Pr-2); }}} $|$\\ \indent
sā \edtext{dhīr nirviṣayā }{\lemma{dhīr nirviṣayā }{\Afootnote{
dhīr nirviṣayā M-A, Pr-A (Pr-2); dhīr\underline{nirvi}ṣayā Pr-B; }}} prāptā sāmānyaṃ ca \edtext{tadagrahe}{\lemma{tadagrahe}{\Afootnote{
tad?grahe Pr-A; tadagrahe Pr-B; }}} $||$
\par
\pend
\endnumbering
\end{document}
[\code]
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service