Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

xslt references

Former Member
0 Likes
685

Hi all,

I would like to get xml result like:


<book id="book_0805033106">
     <isbn>0805033106</isbn>
     <title>Being a Dog Is a Full-Time Job</title>
     <character href="character_Snoopy"/>
</book>

<character id="Snoopy">
     <name>Snoopy</name>
     <since>October 4, 1950</since>
     <qualification>extroverted beagle</qualification>
</character>

I found that xml can have references to elements (done with attributes) here: http://www.xml.com/pub/a/2000/10/04/linking/.

How do I create these xml references within xlst (maybe with xsl:key)?

When I create elements, these look like <type></type>, how do I get them looking like <type id="type-id"></type>?

Also I don't know how to create something like <character href="character_Snoopy"/>.

I would apreciate any/all examples.

Thanks in advance,

Fred

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
665

hi, if you want to get <character href="character_Snoopy"/> , you can do like this:


<xsl:attribute name="href">character_Snoopy</xsl:attribute>
      <xsl:element name="character" use-attribute-sets="href">
        ......
      </xsl:element>

it's a parts of the XSLT, but I think it's enough for you.

thanks

4 REPLIES 4
Read only

Former Member
0 Likes
666

hi, if you want to get <character href="character_Snoopy"/> , you can do like this:


<xsl:attribute name="href">character_Snoopy</xsl:attribute>
      <xsl:element name="character" use-attribute-sets="href">
        ......
      </xsl:element>

it's a parts of the XSLT, but I think it's enough for you.

thanks

Read only

Former Member
0 Likes
665

hi, Fred

Have you tried my answer? Does it work fine?

Maybe the different XSLT version will arise some problem, if so, please make me know.

thanks

Read only

Read only

Former Member
0 Likes
665

Thanks to all who answered.

Greetz Fred