Yes, that's the basic idea. You don't need to mess with the
template that handles elements, because you only need to change
an attribute. This template handles attributes:
<!-- Copy all non-element nodes -->
<xsl:template
match="@*|text()|comment()|processing-instruction()"
mode="profile">
<xsl:copy/>
</xsl:template>
You could just add a new template with match="@entityref", use
xsl:attribute to generate a fileref, and use the function to
convert the entityref value. Your new template will have
precedence over the default attribute handling template for that
attribute.
Bob Stayton
Sagehill Enterprises
DocBook Consulting
----- Original Message -----
From: "Webmaster" <>
To: <>
Sent: Tuesday, April 04, 2006 5:01 PM
Subject: RE: [docbook-apps] profiling and entities
> Hi Bob.
>
> That's what I'm thinking... I'm using the
> profiling\profile.xsl. I'm trying
> to locate the template that it is uses to copy the elements
> over to the
> profiled xml document. It seems to me, that if I make template
> similar to
> what is used in graphics.xsl and "trap" imagedata - I'll can
> rewrite the
> entityrefs into fileref. That should work right?
>
> Or am I dreaming?
>
> -----Original Message-----
> From: Bob Stayton [mailto:]
> Sent: Tuesday, April 04, 2006 6:43 PM
> To: Webmaster;
> Subject: Re: [docbook-apps] profiling and entities
>
>
> Oh my, now I see what the problem is. Your entity declarations
> don't survive the initial transform, so the entityref
> attributes
> become invalid.
>
> I'm not sure how to fix that. Entity declarations in an
> internal
> subset cannot be read and output by XSLT.
>
> It would seem the profiling stylesheet should process the
> entityref attributes and convert them into fileref attributes
> using the unparsed-entity-uri() function in XSLT.
>
> Bob Stayton
> Sagehill Enterprises
> DocBook Consulting
>
>
>
> ----- Original Message -----
> From: "Webmaster" <>
> To: <>
> Sent: Tuesday, April 04, 2006 4:05 PM
> Subject: RE: [docbook-apps] profiling and entities
>
>
>> Hi. Thank you for the quick response.
>>
>> The image names are set as entities in the default.xml:
>>
>> <!ENTITY imagedata1 SYSTEM "socket_mode.gif" NDATA gif>
>> <!ENTITY imagedata2 SYSTEM "serial_tunneling_mode.gif" NDATA
>> gif>
>> <!ENTITY imagedata3 SYSTEM "udp_mode.gif" NDATA gif>
>> <!ENTITY imagedata4 SYSTEM "connection_status.gif" NDATA gif>
>>
>>
>> and the imagedata element calls them:
>>
>> <imagedata entityref="imagedata1"
>> align="center"/></imageobject>
>>
>> (I don't know why the documentation person choose to do it
>> this
>> way, but
>> that's how I got the xml file. Is there a better/typical way?)
>>
>> After I profile the default.xml file, the entities are gone,
>> and the
>> <imagedata> element remains the same (still referencing the
>> entityref, but
>> entities are undeclared).
>>
>> Hope that is clearer.
>> LN
>>
>>
>>
>> -----Original Message-----
>> From: Bob Stayton [mailto:]
>> Sent: Tuesday, April 04, 2006 5:31 PM
>> To: Webmaster;
>> Subject: Re: [docbook-apps] profiling and entities
>>
>>
>> It isn't possible to preserve unresolved entity references in
>> an
>> XSLT transformation. The XML parser resolves them before the
>> stylesheet even sees them.
>>
>> I guess I'm wondering why resolving the entities in the
>> profiling
>> step is different from resolving them in the stylesheet
>> application step, since they resolve to the same thing. How
>> are
>> these entity variables used?
>>
>> Bob Stayton
>> Sagehill Enterprises
>> DocBook Consulting
>>
>>
>>
>> ----- Original Message -----
>> From: "Webmaster" <>
>> To: <>
>> Sent: Tuesday, April 04, 2006 1:52 PM
>> Subject: [docbook-apps] profiling and entities
>>
>>
>>> This is somewhat related to my other post.
>>>
>>> I'm trying to generate htmlhelp, when I do get the profiled
>>> xml
>>> file, none
>>> of the ENTITIES are copied over. I need them as they are
>>> "variables" to the
>>> images that are used throughout the xml file. Is there a way
>>> to
>>> preserve
>>> these?
>>>
>>>
>>> Thank you!
>>>
>>> LN
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail:
>>>
>>> For additional commands, e-mail:
>>>
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>>
>> For additional commands, e-mail:
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
>
> For additional commands, e-mail:
>
>
>
>