[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

How adress what might be attribute or element?

Subject: How adress what might be attribute or element?
From: "cavecatem@xxxxxxxxxxxxx" <cavecatem@xxxxxxxxxxxxx>
Date: Wed, 18 Jan 2006 13:36:27
xmpmeta
Hi all,

I haven't found a solution for two of my current problems in the archive. So I
hope someone out there can help me, or show me where I got off on the wrong
track. I'll do this in two different mails, as the topics are quite
different.
I'm on the digest version of the list, so I can only answer question
tomorrow.

Here comes the first Problem:

I'm working with an XMP-Dump file and want to extract certain data.
Unfortunately, I do not know if the data comes in an element or an attribute,
as both versions are legal with XMP.

So I may have

<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="3.1.1-111">
   <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
      <rdf:Description rdf:about=""
            xmlns:tiff="http://ns.adobe.com/tiff/1.0/">
        <tiff:Orientation>1</tiff:Orientation>
         <tiff:XResolution>720000/10000</tiff:XResolution>

         ....
         </rdf:Description>
      <rdf:Description rdf:about=""
            xmlns:xap="http://ns.adobe.com/xap/1.0/">
         <xap:CreateDate>1999-12-12T14:33:22+01:00</xap:CreateDate>
...

Or
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="3.1.1-111">
   <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
      <rdf:Description rdf:about=""
            xmlns:tiff="http://ns.adobe.com/tiff/1.0/"
          tiff:Orientation="1"
         tiff:XResolution="720000/10000"
         tiff:ImageWidth="12367"
         tiff:ImageLength="3346" />
         ....

      <rdf:Description rdf:about=""
      xmlns:xap="http://ns.adobe.com/xap/1.0/">
      xap:CreateDate="1999-12-12T14:33:22+01:00" />




So at the moment I do this:

    <xsl:template name="Steckbriefkopf">
               <table>
            <tr>
                <td>Image:</td>
                <td>
                     <xsl:value-of
select="/x:xmpmeta/rdf:RDF/rdf:Description/@tiff:ImageWidth" />
                    <xsl:value-of
select="/x:xmpmeta/rdf:RDF/rdf:Description/tiff:ImageWidth" />
                    <xsl:text> x </xsl:text>

                    <xsl:value-of
select="/x:xmpmeta/rdf:RDF/rdf:Description/tiff:ImageLength" />
                       <xsl:value-of
select="/x:xmpmeta/rdf:RDF/rdf:Description/@tiff:ImageLength" />

                    <xsl:text> Pixel</xsl:text>

                </td>
                <td>
                            <xsl:variable name="xresolution">
                                <xsl:value-of
select="/x:xmpmeta/rdf:RDF/rdf:Description/tiff:XResolution" />
                            </xsl:variable>
                            <xsl:variable name="yresolution">
                                <xsl:value-of
select="/x:xmpmeta/rdf:RDF/rdf:Description/tiff:YResolution" />
                            </xsl:variable>


                    <xsl:choose>
                        <xsl:when test="$xresolution = $yresolution">
                            <xsl:value-of select="$yresolution"/>

                        </xsl:when>
                        <xsl:otherwise>
                            <xsl:value-of select="$xresolution" />
                            <xsl:text> x </xsl:text>
                            <xsl:value-of select="$yresolution" />
                        </xsl:otherwise>
                    </xsl:choose>
                    <xsl:choose>
                        <xsl:when
test="/x:xmpmeta/rdf:RDF/rdf:Description/@tiff:ResolutionUnit !=3">
                            <xsl:text> dpi</xsl:text>
                        </xsl:when>
                        <xsl:when
test="/x:xmpmeta/rdf:RDF/rdf:Description/tiff:ResolutionUnit !=3">
                            <xsl:text> dpi</xsl:text>
                        </xsl:when>
                        <xsl:otherwise>
                            <xsl:text> Pixel/cm</xsl:text>
                        </xsl:otherwise>
                    </xsl:choose>
                </td>
            </tr>


When it comes to the resolution, I'm a bit stuck.

Can I put two <xsl:value-of select /> statements in each variable?



And besides, all this
<xsl:value-of select="@namspace:bla />
<xsl:value-of select="namespace:bla />

makes the code rather long and slows down the processing.Is there a better way
to do this?

Would
<xsl:value-of select="@namespace:bla | namespace:bla" be any better where
performance is concerned?

Regards from a snowy Berlin
CJ

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.