VirtualBox

source: vbox/trunk/src/libs/dita-ot-1.8.5/xsl/common/output-message.xsl@ 98727

Last change on this file since 98727 was 98584, checked in by vboxsync, 2 years ago

Docs: bugref:10302. Setting svn properties of DITA-OT library.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.6 KB
Line 
1<?xml version="1.0" encoding="UTF-8" ?>
2<!-- This file is part of the DITA Open Toolkit project hosted on
3 Sourceforge.net. See the accompanying license.txt file for
4 applicable licenses.-->
5 <!-- (c) Copyright IBM Corp. 2004, 2005 All Rights Reserved. -->
6
7 <!--
8 Standard error message template for DITA processing in XSL. This
9 file should be included by any XSL program that uses the standard
10 message template. To include this file, you will need the following
11 two commands in your XSL:
12
13 <xsl:include href="output-message.xsl"/> - Place with other included files
14
15 <xsl:variable name="msgprefix">DOTX</xsl:variable> - Place with other variables
16
17
18 The template takes in the following parameters:
19 - msg = the message to print in the log; default=***
20 - msgcat = message category, default is read from $msgprefix
21 - msgnum = the message number (3 digits); default=000
22 - msgsev = the severity (I, W, E, or F); default=I (Informational)
23 -->
24
25
26 <xsl:stylesheet version="1.0"
27 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
28 <xsl:template name="output-message">
29 <xsl:param name="msg" select="'***'"/>
30 <xsl:param name="msgcat" select="$msgprefix"/>
31 <xsl:param name="msgnum" select="'000'"/>
32 <xsl:param name="msgsev" select="'I'"/>
33 <xsl:param name="msgparams" select="''"/>
34
35 <xsl:variable name="msgid">
36 <xsl:value-of select="$msgcat"/>
37 <xsl:value-of select="$msgnum"/>
38 <xsl:value-of select="$msgsev"/>
39 </xsl:variable>
40 <xsl:variable name="msgdoc" select="document('../../resource/messages.xml')"/>
41 <xsl:variable name="msgcontent">
42 <xsl:choose>
43 <xsl:when test="$msg!='***'">
44 <xsl:value-of select="$msg"/>
45 </xsl:when>
46 <xsl:otherwise>
47 <xsl:apply-templates select="$msgdoc/messages/message[@id=$msgid]" mode="get-message-content">
48 <xsl:with-param name="params" select="$msgparams"/>
49 </xsl:apply-templates>
50 </xsl:otherwise>
51 </xsl:choose>
52 </xsl:variable>
53 <xsl:variable name="localclass"><xsl:value-of select="@class"/></xsl:variable>
54 <xsl:variable name="debugloc">
55 <!-- Information on how to find the error; file name, followed by element counter: -->
56 <!-- (File = filename.dita, Element = searchtitle:1) -->
57 <xsl:if test="@xtrf|@xtrc">
58 <xsl:text>(</xsl:text>
59 <xsl:if test="@xtrf">
60 <xsl:text>File = </xsl:text><xsl:value-of select="@xtrf"/>
61 <xsl:if test="@xtrc"><xsl:text>, </xsl:text></xsl:if>
62 </xsl:if>
63 <xsl:if test="@xtrc"><xsl:text>Element = </xsl:text><xsl:value-of select="@xtrc"/></xsl:if>
64 <xsl:text>)</xsl:text>
65 </xsl:if>
66 </xsl:variable>
67
68 <xsl:variable name="m">
69 <xsl:value-of select="$msgcontent"/>
70 <xsl:if test="normalize-space($debugloc)">
71 <xsl:value-of select="concat(' The location of this problem was at ',$debugloc)"/>
72 </xsl:if>
73 </xsl:variable>
74 <xsl:choose>
75 <xsl:when test="$msgsev = 'F'">
76 <xsl:message terminate="yes">
77 <xsl:value-of select="$m"/>
78 </xsl:message>
79 </xsl:when>
80 <xsl:otherwise>
81 <xsl:message>
82 <xsl:value-of select="$m"/>
83 </xsl:message>
84 </xsl:otherwise>
85 </xsl:choose>
86 </xsl:template>
87
88 <xsl:template match="message" mode="get-message-content">
89 <xsl:param name="params"/>
90 <xsl:variable name="reason" select="reason/text()"/>
91 <xsl:variable name="response" select="response/text()"/>
92 <xsl:variable name="messageType"><xsl:value-of select="@type"/></xsl:variable> <!--record this messageType as Information in the log file when parsing the xml add by wxzhang 20070515 -->
93 <xsl:text>[</xsl:text><xsl:value-of select="@id"/><xsl:text>]</xsl:text>
94 <xsl:text>[</xsl:text><xsl:value-of select="@type"/><xsl:text>]</xsl:text>
95 <xsl:text>: </xsl:text>
96 <xsl:call-template name="replaceParams">
97 <xsl:with-param name="string" select="$reason"/>
98 <xsl:with-param name="params" select="$params"/>
99 </xsl:call-template>
100 <xsl:text> </xsl:text>
101 <xsl:call-template name="replaceParams">
102 <xsl:with-param name="string" select="$response"/>
103 <xsl:with-param name="params" select="$params"/>
104 </xsl:call-template>
105 </xsl:template>
106
107 <xsl:template name="replaceParams">
108 <xsl:param name="string"/>
109 <xsl:param name="params"/>
110 <xsl:choose>
111 <xsl:when test="contains($params,';')">
112 <xsl:variable name="param" select="substring-before($params,';')"/>
113 <xsl:variable name="newString">
114 <xsl:call-template name="replaceString">
115 <xsl:with-param name="string" select="$string"/>
116 <xsl:with-param name="match" select="substring-before($param,'=')"/>
117 <xsl:with-param name="replacement" select="substring-after($param,'=')"/>
118 </xsl:call-template>
119 </xsl:variable>
120 <xsl:call-template name="replaceParams">
121 <xsl:with-param name="string" select="$newString"/>
122 <xsl:with-param name="params" select="substring-after($params,';')"/>
123 </xsl:call-template>
124 </xsl:when>
125 <xsl:when test="contains($params,'=')">
126 <xsl:call-template name="replaceString">
127 <xsl:with-param name="string" select="$string"/>
128 <xsl:with-param name="match" select="substring-before($params,'=')"/>
129 <xsl:with-param name="replacement" select="substring-after($params,'=')"/>
130 </xsl:call-template>
131 </xsl:when>
132 <xsl:otherwise>
133 <xsl:value-of select="$string"/>
134 </xsl:otherwise>
135 </xsl:choose>
136 </xsl:template>
137
138 <xsl:template name="replaceString">
139 <xsl:param name="string"/>
140 <xsl:param name="match"/>
141 <xsl:param name="replacement"/>
142 <xsl:choose>
143 <xsl:when test="contains($string,$match)">
144 <xsl:value-of select="substring-before($string,$match)"/>
145 <xsl:value-of select="$replacement"/>
146 <xsl:call-template name="replaceString">
147 <xsl:with-param name="string"
148 select="substring-after($string,$match)"/>
149 <xsl:with-param name="replacement" select="$replacement"/>
150 <xsl:with-param name="match" select="$match"/>
151 </xsl:call-template>
152 </xsl:when>
153 <xsl:otherwise>
154 <xsl:value-of select="$string"/>
155 </xsl:otherwise>
156 </xsl:choose>
157 </xsl:template>
158
159 </xsl:stylesheet>
160
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette