Click to See Complete Forum and Search --> : XSL - selecting elements (newbie)


jackson424
12-13-2007, 01:15 AM
I am a completely a newbie with XML and no programming experience at all......but my boss ask me to read a XML without a XSL file.....Plz help!!

I have a xml document consist of thousands of this

<nodeId>11400845923281173</nodeId>
<serverId>4py</serverId>
<property type="cw" name="label" lang="en">LukSuk<property>
<property type="cw" name="label" lang="zh">LukSuk(Can)</property>
<property type="cw" name="url" lang="en">uncle6million</property>
<property type="cw" name="url">uncle6million</property>
<property type="private" name="background-color">lightblue</property>
<property type="private" name="option-type">uncle6</property>
<property type="private" name="style">make-label</property>
<property type="private" name="details-label">DETAILS</property>

What I need is just the bolded fields....
I sucessfully extract nodeId into a row, but <property type="private" name="details-label"> can't be extracted.....When I try to extract this field, all <property> are extracted into 1 single cell

here is my way to extract
<xsl:value-of select="nodeId"/>

Please advise how should I write in the XSL file...Thanks!!!

jkmyoung
12-13-2007, 02:41 PM
<xsl:value-of select="property[@name='details-label']"/>

jackson424
12-13-2007, 08:09 PM
:) Thanks a lot jkm. It works!

However, in case if i need to specify type also, how should I write? Thanks

jkmyoung
12-18-2007, 11:38 AM
<xsl:value-of select="property[@name='details-label'][@type='private']"/>