This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: character entities


David,

> so... what I'd like (Mike:-) is for the entities to get expanded on
> the way in, but to have some markers in the stream so I can fold
> them up on the way out. (You can do this by hand by editing the dtd
> to add pi's at the beginning and end of every entity definition, but
> it's a bit of a pain.

That's kind of what I was talking about with the substitution with
element on parse of the source document. If you had:

  <doc>... &e04BL-a; ...</doc>

in your source, and then you had a stylesheet with a flag that said
'include the entity references as elements' then the stylesheet would
see:

  <doc>... <phys:entity-ref name="e04BL-a">...</phys:entity-ref> ...</doc>

You could get access to the content of the phys:entity-ref; most
importantly, the string value of the doc element would be the same as
if the entity were naturally expanded, and you could have a template
that went:

<xsl:template match="phys:entity-ref">
  <xsl:entity-ref name="{@name}" />
</xsl:template>

to create the entity reference on output (assuming that's what
xsl:entity-ref does).

The trouble is that your lovely logic about the children of the doc
element needs to extend to cover grandchildren within the
phys:entity-ref element as well. That's the advantage with using PIs -
children are still children - but then the logic of wrapping up the
entity again is complicated. Either you have to do the wrapping up in
the stylesheet (which is messy) or the processor has to do it (which
is risky as it would be easy to forget the 'end' PI).

And of course neither works with entity references within attribute
values.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]