[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] Generating
Re: [xsl] Generating
Subject: Re: [xsl] Generating <!ENTITY list
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 18 Mar 2009 18:46:43 +0100
At 2009-03-18 17:53 +0530, Ganesh Babu N wrote:
Dear All,
I am having
input:
<graphic file="1.jpg"/>
<graphic file="2.jpg"/>
I need to create <!ENTITY List inside the DOCTYPE. Is the any way i
can achieve this using XSL. I am using ver 2.0 and saxon9.
The output should be :
<!DOCTYPE article
[
<!ENTITY gr1 SYSTEM "1.jpg" NDATA IMAGE>
<!ENTITY gr2 SYSTEM "2.jpg" NDATA IMAGE>
]>
Absolutely there is a way ... in both XSLT 1.0 and 2.0 ... this is a
use case I tell students justifies the dangerous
disable-output-escaping= attribute.
I say "dangerous" because it does not help when the output tree from
the transformation is used as the input tree for a subsequent
process. It is only helpful when you are serializing your output
tree into output angle-bracket syntax, and the processor you are
using supports serialization.
I hope the example below for both XSLT 1.0 and 2.0 helps.
. . . . . . . . Ken
t:\ftemp>type ganesh.xml
<graphics>
<graphic file="1.jpg"/>
<graphic file="2.jpg"/>
</graphics>
t:\ftemp>call xslt ganesh.xml ganesh.xsl
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE article
[
<!ENTITY gr1 SYSTEM "1.jpg" NDATA IMAGE>
<!ENTITY gr2 SYSTEM "2.jpg" NDATA IMAGE>
]>
<article><!--The article goes here--></article>
t:\ftemp>type ganesh.xsl
<?xml version="1.0" encoding="US-ASCII"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output indent="yes"/>
<xsl:template match="/">
<xsl:text disable-output-escaping="yes"><![CDATA[
<!DOCTYPE article
[
]]></xsl:text>
<xsl:for-each select="/*/graphic">
<xsl:value-of disable-output-escaping="yes"
select="concat('<!ENTITY gr',
substring-before(@file,'.'),
' SYSTEM "',@file,
'" NDATA IMAGE>')"/>
<xsl:text>
</xsl:text>
</xsl:for-each>
<xsl:text disable-output-escaping="yes">]>
</xsl:text>
<article>
<xsl:comment>The article goes here</xsl:comment>
</article>
</xsl:template>
</xsl:stylesheet>
t:\ftemp>
--
XSLT/XSL-FO/XQuery training in Los Angeles (New dates!) 2009-06-08
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread
- [xsl] Generating <!ENTITY list
- Ganesh Babu N - 18 Mar 2009 12:24:42 -0000
- Michael Kay - 18 Mar 2009 12:44:42 -0000
- Message not available
- G. Ken Holman - 18 Mar 2009 17:48:36 -0000 <=
<- Previous Index Next ->
RE: [xsl] Generating <!ENTITY list, Michael Kay
Thread
[xsl] XSL-FO - border straying wher, Trevor Nicholls
Re: [xsl] XSL-FO - border straying , Christopher R. Maden
Date
[xsl] Capturing position as a numbe, Charles Flanders
Month
Keywords
Subject: Re: [xsl] Generating <!ENTITY list From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Wed, 18 Mar 2009 18:46:43 +0100 |
I am having
input:
<graphic file="1.jpg"/> <graphic file="2.jpg"/>
I need to create <!ENTITY List inside the DOCTYPE. Is the any way i can achieve this using XSL. I am using ver 2.0 and saxon9.
The output should be :
<!DOCTYPE article [ <!ENTITY gr1 SYSTEM "1.jpg" NDATA IMAGE> <!ENTITY gr2 SYSTEM "2.jpg" NDATA IMAGE> ]>
-- XSLT/XSL-FO/XQuery training in Los Angeles (New dates!) 2009-06-08 Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Generating <!ENTITY list, Michael Kay | Thread | [xsl] XSL-FO - border straying wher, Trevor Nicholls |
Re: [xsl] XSL-FO - border straying , Christopher R. Maden | Date | [xsl] Capturing position as a numbe, Charles Flanders |
Month |
Keywords