RE: Interesting problem

Subject: RE: Interesting problem
From: "Didier PH Martin" <martind@xxxxxxxxxxxxx>
Date: Mon, 16 Aug 1999 16:20:33 -0400
Hi,

Problem to resolve:
---------------------------------------------------
> A very interesting problem has been posted on the XSL list. How would we
> resolve it in DSSSL. I'll take the best solution from both world and
publish
> it.
>
> Suppose I had the following XML fragment:
>
>     <entry>
>       <key>foo</key>
>       <description>A sample link</description>
>     </entry>
>
> Suppose I would like to create the following output using XT:
>
>     <a href="http://www.frob.org/search?type=simple&key=foo";>A sample
> link</a>
>
> How would I go about this?  My problem is how to create the `href'
> attribute of the output element `a', in particular how to concat the
> constant string "http://www.frob.org/search?type=simple&key="; and the
> content of the `key' input element.

Solution 1: (XSL)
------------------------------------------------
,-----
| <xsl:template match="entry">
|   <a>
|     <xsl:attribute name="href">
|       http://www.frob.org/search?type=simple&amp;key= <xsl:value-of
select="key"/>
|     </xsl:attribute>
|     <xsl:apply-templates match="description"/>
|   </a>
| </xsl:template>
`-----


Solution 1: (DSSSL)
------------------------------------------------
If I got the question right, the following untested code fragment
should do the trick using jade's sgml extension FOs.

(element (entry key) (empty-sosofo))
(element entry
  (make element
    gi: "a"
    attributes: `(("href"
                   ,(string-append
                      "http://www.frob.org/search?type=simple&key=";
                      (data (select (children (current-node)  "key"))))))
    (process-children)))


Solution 2: (DSSSL)
-----------------------------------------------

OK I'll try this one:
(element (entry key) (empty-sosofo))
(element entry
	(make link
		address: (url-address
	                   (string-append
"http://www.frob.org/search?type=simple&key=";
			       (data (select (children (current-node)  "key"))))
			    )
	)
)
The premise to the solution is that the address object support the url type
of address :-) and the other premise id that you use the "-t html" output
format. stay tuned this is for soon...
Note: I suppose Kai that your original document is in XML format, then with
the addition of the following W3C header proposal you get a document
rendered into html
<?xml-stylesheet href="myscript.dsl" type="text/dsssl" media="screen,html">
or as soon as the rtf backend get this new address object
<?xml-stylesheet href="myscript.dsl" type="text/dsssl" media="print,rtf">
or as soon as we have the MIF backend with this new address object:
<?xml-stylesheet href="myscript.dsl" type="text/dsssl" media="print,mif">

other solutions? (why not a transformation based solution?)

regards
Didier PH Martin
mailto:martind@xxxxxxxxxxxxx
http://www.netfolder.com


 DSSSList info and archive:  http://www.mulberrytech.com/dsssl/dssslist


Current Thread